Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
USE with a variable
Message
 
 
À
22/03/2011 13:54:05
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01504526
Message ID:
01504546
Vues:
59
This message has been marked as a message which has helped to the initial question of the thread.
>>It doesn't work either because USE command is scoped to a batch.
>
>Could you elaborate more on the topic? When I do that, it works.

It reverts back to the current DB after EXECUTE (which is a separate batch) completes.
SELECT DB_NAME()

EXECUTE(@Command + ';SELECT DB_NAME()')

SELECT DB_NAME()
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform