Add A Stored Procedure to the SQL Server Master Database

So you are interested in creating a stored procedure that will be used my multiple databases, so which database should you use? Maybe this is a candidate for putting you new stored procedure in the Master database. In this article by John Morehouse, we hear more about our options.

The discussion was primarily around whether or not you had to mark the stored procedure as a ‘system procedure’.  Well, turns out that you don’t. However, after a little research I found out that by marking it as a ‘system procedure’, it will allow the procedure to run in the context of the database you are currently in versus running within the Master database, specifically when dealing with system objects.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s