Hi I have a table with a lot of lock with the value of -2. I cannot kill the session id process using kill cmd. Does anyone know what SPID with -2 means.
I run this query:
SELECT OBJECT_NAME(P.object_id) AS TableName,
Resource_type,
request_session_id
FROM sys.dm_tran_locks L
JOIN sys.partitions P ON L.resource_associated_entity_id = p.hobt_id
WHERE OBJECT_NAME(P.object_id) = 'Table '
Sample Output
Table Name
ClaimRequest
Resource_Type
KEY / Page
request_session_id
-2
There are 23770 rows of data of this type
Found out -2 is orphaned Transaction from Distributed Transaction. If you need to kill -2 SPID use this link https://www.mssqltips.com/sqlservertip/4142/how-to-kill-a-blocking-negative-spid-in-sql-server/