Skip to content

Instantly share code, notes, and snippets.

@ainsofs
Created November 28, 2019 21:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ainsofs/7a1f519f589509030a810e0cdef947d9 to your computer and use it in GitHub Desktop.
-- kill all connections For MS SQL Server 2000, 2005, 2008
USE master;
DECLARE @kill varchar(8000); SET @kill = '';
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), spid) + ';'
FROM master..sysprocesses
WHERE dbid = db_id('MyDB')
EXEC(@kill);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment