Q

Running a stored procedure in context with the master database

SQL Server Development expert Greg Low explains how to access objects in the master database.

I have a stored procedure "Test" running in context with say, the db1 database. I want the stored procedure to run in context with the master database - not db1. How is this done?
To access objects in the master database, you can specify the three part name for the objects eg: master.dbo.someobject from a proc in any database.
This was last published in June 2006

Dig Deeper on SQL Server Stored Procedures

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close