Hi guysI've created the stored procedure for restoring db and I put this into Administration db. I got the following error message:Database state cannot be changed while other users
One of the SQL statements is:--SET @sSQLAlter1 = 'ALTER DATABASE ' + @sNewDBName + ' SET OFFLINE WITH ROLLBACK IMMEDIATE;'SET @sSQLAlter1= 'EXEC master.dbo.sp_dboption ''' + @sNewDBName + ''', ''offline'', ''TRUE'''
I have to use master.dbo.sp_dboption due to this need to be run on master, and can't really use ALTER DATABASE statement cause it's running on Administration database and can't use USE statement.What did I do wrong then?Thanks