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')

7 comments:

  1. Beautiful simplicity. Perfect!! Thank you.

    ReplyDelete
  2. Nicest information!!! I'll be enchanted to greatly help due to what I've learnt from here.
    user experience design agency

    ReplyDelete
  3. He arrived on time, and expertly investigated and recognized the problem.
    web design SF

    ReplyDelete
  4. This web page has given me loads to keep in mind and what I wanted for years!! What an extraordinary solution to design studios!!
    company logo design

    ReplyDelete
  5. Every day I visit a number of blog sites to see content, however this offers quality based content.
    brand strategy firms

    ReplyDelete
  6. Hi, I have just started to SQL Certification Online. and this blog is really informative for me. Keep us posted for this kind of valuable blog. Thank you for this blog!

    ReplyDelete
  7. I liked your blog because there is a lot of good information in it, if you look for java script in
    Training Services Company in Dinanagar then you will not get anything better than Satyam Technology.

    ReplyDelete