Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TSQL question
Message
De
11/08/2000 23:28:27
 
 
À
11/08/2000 17:54:08
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00404063
Message ID:
00404274
Vues:
11
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform