Consider I am working in Database A. Using a stored procedure I want to change the database from A to master by executing that stored procedure..
I tried this one but the database is not getting changed
declare @dbname varchar(100)
declare @str varchar(100)
set @dbname = 'master'
set @str = 'use ' + @dbname
exec (@str)
it executed successfully. But the database is not changed.. Please advise
I tried this one but the database is not getting changed
declare @dbname varchar(100)
declare @str varchar(100)
set @dbname = 'master'
set @str = 'use ' + @dbname
exec (@str)
it executed successfully. But the database is not changed.. Please advise