Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TSQL question
Message
From
11/08/2000 23:28:27
 
 
To
11/08/2000 17:54:08
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00404063
Message ID:
00404274
Views:
10
>so - how can I "use" a database that is passed in as a parameter or determined somehow and stored in a variable - short of putting everything in one big variable and executing it?
>
>specifically (in pseudo code) I want to:
>
>1 - save current database (which can be anything) in variable
>2 - switch to another known database
>3 - do some stuff
>4 - switch back to orignal database



Unfortunatly, I have no idea on that. However, maybe this can work in your case: in number 3 (do some stuff), if you are building your queries on the fly, you could use the full declarative of the tables you are using, which is database.owner.name . For example, this will work (tested):

use master
select * from pubs.dbo.authors


I don't know if this applies to your situation, though...
Sylvain Demers
Previous
Reply
Map
View

Click here to load this message in the networking platform