SQL Server – kill all processes connected to a database

Posted by Andy on April 27, 2011
Computers, Software Development

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.

7 Comments to SQL Server – kill all processes connected to a database

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>