Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
USE with a variable
Message
De
22/03/2011 13:55:18
 
 
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:
01504544
Vues:
40
>There is no simpler way (unless changing connection string to use correct database). Dynamic tables / databases require dynamic SQL. Answered the exact same question in almost the same way here
>http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/ecc2e569-5a05-41e0-9201-de0a1dcd9870
>
>Although you may need to create the whole script dynamically, not just USE statement.

There has to be a USE because the rest of the script negotiate with grabbing data from another database. So, one has to be set as the actual and the other one specified in the script where needed when using foreign database tables.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform