Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-04-21 : 22:27:39
|
| Shawn B writes "I am attempting to build a T-SQL script to switch databases based on a desired environment (Dev, Test, etc.).What I would like to do is something like:declare @db varchar(32)set @db = 'Dev'use @dbObviously this doesn't work. Nor does:exec sp_executesql 'use Dev'because the database switch only lasts as long as the EXEC runs and I am placed back where I was before the EXEC.So, how can I dynamically make the database switch?Thanks,Shawn." |
|
|
Nazim
A custom title
1408 Posts |
|
|
|
|
|