Posted By

tclancy on 04/06/11


Tagged

sqlserver


Versions (?)

Kill Connections to SQL Server


 / Published in: SQL
 

URL: http://stackoverflow.com/questions/11620/how-do-you-kill-all-current-connections-to-a-sql-server-2005-database

  1. ALTER DATABASE DB_NAME SET SINGLE_USER WITH ROLLBACK IMMEDIATE
  2. GO
  3. -- do stuff
  4. Go
  5. ALTER DATABASE DB_NAME_NEW SET MULTI_USER -- set back to multi user
  6. GO

Report this snippet  

You need to login to post a comment.