Can we create objects(tables, SPs, triggers, etc...) in the master database. If yes, in which cases can they be required and are helpful??
asked May 04, 2012 at 04:58 AM in Default
Yes, you can create objects in the master database, but you should not create unnecesary users objects in it.
It has sense to create some custom stoerd procedures, views in the master database which are used for management and administration of the server.
It is usefull for example for stored procs like sp_who2, sp_find, sp_CloneRights, which can be custom stored procedures marked as system procedures.
In that case even they reside in master database, then are available for all databses and in case of proceures marked as system, they will operate in the context of current database.
answered May 04, 2012 at 05:14 AM
Master is like any other database, you can create tables, views etc, but Master is a system database, not a user database.
Except for some instance wide procedures (which Pavel mentioned), don't treat this database as a user database. It's true that some system information is stored in the resource database, but that doesn't mean the master database should be available for user applications.
answered May 04, 2012 at 09:28 AM
Wilfred van Dijk