Master Database

Can we create objects(tables, SPs, triggers, etc...) in the master database. If yes, in which cases can they be required and are helpful??

more ▼

asked May 04, 2012 at 04:58 AM in Default

avatar image

30 4 4 7

If I am not mistaken, I believe that now the system objects are not stored in the master db but in the resource db. So does creating these objects in master make enough relevence?? Also, has anyone tried creating tables in the master db?? If yes, in what senario you came accross that requirement?? If not, can they be created and when can they be useful??

May 04, 2012 at 06:05 AM mituljain9
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered May 04, 2012 at 05:14 AM

avatar image

Pavel Pawlowski
22.7k 10 15 26

(comments are locked)
10|1200 characters needed characters left

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.

more ▼

answered May 04, 2012 at 09:28 AM

avatar image

Wilfred van Dijk
3.6k 29 39 49

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: May 04, 2012 at 04:58 AM

Seen: 777 times

Last Updated: May 04, 2012 at 09:54 AM

Copyright 2018 Redgate Software. Privacy Policy