Terminates a user process based on the system process ID (SPID). If the specified SPID has a lot of work to undo, the KILL may take some time to complete.
KILL {spid}
KILL is commonly used to terminate a process that is blocking other important processes with locks, or to terminate a process that is executing a query that is using necessary system resources. System processes and processes running an extended stored procedure cannot be terminated.
Use KILL very carefully, especially when critical processes are running. You cannot kill your own process. Other processes not to kill are:
Execute sp_who to get a report on valid SPID values. Use @@SPID to display the SPID value for the current session.
KILL permissions default to the members of the sysadmin fixed database role, and are not transferable.
This example shows how to terminate SPID 10.
KILL 10
Functions | sp_who |
SHUTDOWN | @@SPID |
sp_lock |