DBA- Generate Script To Bring All User Databases Offline in SQL Server



Quickly generate script to bring all SQL Server Databases offline.

SELECT 'ALTER DATABASE ['+name+'] SET OFFLINE WITH NO_WAIT'+CHAR(10)+' GO' FROM 
MASTER.sys.databases
WHERE name NOT IN ('master','tempdb','model','msdb','distribution')