June 21, 2015 at 8:49 pm
_______________________________________________________
DECLARE @strSQL1 Varchar(MAX)
StrSQL2 = 'SELECT state_desc FROM sys.databases where name = 'dbname' '
if state_desc = 'ONLINE'
exec sp_detach_db @dbname='dbname'
else
print @StrSQL1
_____________________________________________________
I am trying to prepare a script(above) by using the Logic: 1st check Db is online if yes then Detach dB, If no ignore .
Any suggestions pls for above code.
June 21, 2015 at 9:58 pm
my script is working.
Thanks.
June 22, 2015 at 5:37 pm
charipg (6/21/2015)
my script is working.Thanks.
Can you post the script that's actually working for you please? Thanks.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply