Q

Should I switch databases inside the procedure?

Rather than use a command to switch from one database to another database in a procedure, expert Greg Low offers a better alternative.

How can I use USE statements inside the procedure to change from one database to another in SQL 2000? Is there any command for switching from one database to another database?
Rather than switching databases, just refer to the table in the other database directly eg: SELECT SomeColumn FROM SomeDatabase.dbo.SomeTable
This was last published in December 2005

Dig Deeper on SQL-Transact SQL (T-SQL)

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