DECLARE @SQLString VARCHAR(MAX) = ''
Select @SQLString = @SQLString + 'ALTER DATABASE ' + QUOTENAME(name) + ' SET SINGLE_USER WITH ROLLBACK IMMEDIATE;DROP DATABASE ' + QUOTEName(name) + ';'
FROM sys.databases
WHERE name NOT IN ('master','model','msdb','tempdb')
OR is_distributor = 0x1
EXEC(@SQLString)
0 comments:
Post a Comment