SQL Server – How to find and kill negative spid

To find out negative spid in sql server, you can use below query. This query will give the negative spid  and kill command.

Copy this command and execute against master database to kill negative spid.

select  distinct convert (smallint, req_spid) As spid,
 DB_NAME(rsc_dbid) As dbname,
 'kill  '''+ cast (req_transactionUOW as varchar(50)) +'''' as KillCommand
from  master.dbo.syslockinfo
where req_spid < 0 and req_transactionUOW <> '00000000-0000-0000-0000-000000000000'

Output will give you the kill command of negative spid

Leave a Reply




8 − = 0