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.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.