Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
USE with a variable
Message
 
 
To
22/03/2011 13:54:05
General information
Forum:
Microsoft SQL Server
Category:
Scripting
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01504526
Message ID:
01504546
Views:
62
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform