x

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 '12 at 04:58 AM in Default

mituljain9 gravatar image

mituljain9
30 4 4 6

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 '12 at 06:05 AM mituljain9
(comments are locked)
10|1200 characters needed characters left

2 answers: sort oldest

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 '12 at 05:14 AM

Pavel Pawlowski gravatar image

Pavel Pawlowski
22.2k 8 11 21

(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 '12 at 09:28 AM

Wilfred van Dijk gravatar image

Wilfred van Dijk
927 18 20 24

(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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

SQL Server Central

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

Topics:

x11

asked: May 04 '12 at 04:58 AM

Seen: 554 times

Last Updated: May 04 '12 at 09:54 AM