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')
TechBrothersIT is a blog and YouTube channel sharing real-world tutorials, interview questions, and examples on SQL Server (T-SQL, DBA), SSIS, SSRS, Azure Data Factory, GCP Cloud SQL, PySpark, ChatGPT, Microsoft Dynamics AX, Lifecycle Services, Windows Server, TFS, and KQL. Ideal for data engineers, DBAs, and developers seeking hands-on, step-by-step learning across Microsoft and cloud platforms.
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')
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.