hI
I was wondering if it were possible to dynamically set the database with the use statement?
I have tried
exec ('use '+@db)
and have tried to use
exec sp_executesql N'use '+@db,N'@db varchar(50)',@db=@dbtobeused
neither seem to work. I am thinking this is because it is out of scope. Is there any way to be able to do this?
thanks!
I was wondering if it were possible to dynamically set the database with the use statement?
I have tried
exec ('use '+@db)
and have tried to use
exec sp_executesql N'use '+@db,N'@db varchar(50)',@db=@dbtobeused
neither seem to work. I am thinking this is because it is out of scope. Is there any way to be able to do this?
thanks!