How can I stop a SQL Server process?

Neil Pike

July 27, 1999

1 Min Read
ITPro Today logo

A. Do a select * from sysprocesses and identify the spid in question. Then do a "KILL "

This will mark the spid as "dead". Note that it may take a while for the process to end as it has to rollback all the updates that it has been doing. Also kill only marks the process as dead - the process itself needs to check for this, and if it is stuck in a loop as the result of a bug or whateverthen it won't terminate. Also certain processes like dump and dbcc commands have significant code paths where the kill command is not checked for and so these can take some time to terminate.

Also, if the process is in an extended-stored procedure, or is waiting on network traffic/remote stored-procedure it will not check whether it has been terminated until these actions have been completed.

See Q171224 for more info - including details on the waittype that can tell you what a process is waiting on.

If the process won't die for one of the above reasons then your only choice is to stop the sqlservr.exe process itself and re-start.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like