Ask the Expert

Should I switch databases inside the procedure?

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?

    Requires Free Membership to View

Rather than switching databases, just refer to the table in the other database directly eg: SELECT SomeColumn FROM SomeDatabase.dbo.SomeTable

This was first published in December 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: