Pages

Saturday, August 28, 2010

Creating SP in Master database

So you want to create a stored procedure
in the master database in order to be able
to access it from any database in the server
without specifing the fully qualified name
and take an advantage of dynamic contex,
meaning the procedure will be executed in
the context of the calling database.

Ok, first of all, give prefix "sp_" and another thing you should
know:

You have to mark the SP as System in order to make the
dynamic contex thing working.

EXEC sp_MS_marksystemobject 'sp_spname'

No comments:

Post a Comment