Kill Connections to SQL Server


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.