How to Kill a SPID in SQL Server?

If you are a DBA or database developer, you would have encountered a lot of blocking scenarios. Blockings are nothing but the clash between two session IDs. A session is nothing but a transaction like an insert, update or delete for a particular process, which is assigned in the form of SPID in the SQL server.

Further, when we come across a situation to kill a session or SPID in SQL server that means we are trying to stop the transaction. But before killing the SPID, see the sessions running currently could be viewed using the command:

EXEC SP_WHO2 ACTIVE


To kill the session in a particular database, use the below command:

USE <database_name>
GO
KILL <SPID_Number>

Example: Kill 278

0 comments:

Post a Comment