in

Citrus-Lime Blog

Information on Citrus-Lime including our eCommerce and Retail Projects

CoolSQL

Batch Detach Databases

Run this script and send the results to a text file. The resulting text file is a script to detach every database on the server.

--Detaching
EXEC sp_MSforeachdb
'IF N''?'' NOT IN(''model'' ,''master'', ''msdb'', ''tempdb'')
BEGIN
SELECT ''EXEC sp_detach_db ''''?'''',''''true''''''
END'

 

Comments

No Comments