One of a set of tools we're offering as a way of saying thank you for being a part of the community.
set nocount on declare @dbname as varchar(80) declare @server_name as varchar(20) select @server_name = @@servername declare rs_cursor CURSOR for select name from master.dbo.sysdatabases where name like ('eqs%') AND name not in ('eqs_test', 'eqs_log') open rs_cursor Fetch next from rs_cursor into @dbname IF @@FETCH_STATUS <> 0 PRINT 'No database to backup...Please check your script!!!' WHILE @@FETCH_STATUS = 0 BEGIN print 'sp_detach_db' + @dbname print 'go' print 'print ''Detach of ' + upper(@dbname) + ' database successfully completed''' print 'go' PRINT ' ' FETCH NEXT FROM rs_cursor INTO @dbname END CLOSE rs_cursor deallocate rs_cursor print ' ' print 'print ''SERVER NAME : ' + upper(@server_name) + '--> All databases successfully detached'''
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.