Monthly Archives: April 2011

SQL Server – kill all processes connected to a database

Posted by Andy on April 27, 2011
Computers, Software Development / 7 Comments

Below is a little script to kill all the processes which are currently connected to your SQL Server database.  I’m posting this mostly for myself for future reference.  The preferable way to do this is to use the alter database set single_user thing, but that doesn’t always work, so this is the “drastic measure” option.