sqlserver 表死锁处理

SELECT request_session_id as spid,
OBJECT_NAME(resource_associated_entity_id) AS tableName
FROM sys.dm_tran_locks WHERE resource_type = 'OBJECT'

DECLARE @spid INT;
SET @spid = 132;
DECLARE @sql VARCHAR(1000);
SET @sql = 'KILL '+ CAST(@spid AS VARCHAR);
EXEC (@sql);

 

error:

SELECT request_session_id as spid,
OBJECT_NAME(resource_associated_entity_id) AS tableName
FROM sys.dm_tran_locks WHERE resource_type = 'OBJECT'

DECLARE @spid INT;
SET @spid = 132;
DECLARE @sql VARCHAR(1000);
SET @sql = 'KILL '+ CAST(@spid AS VARCHAR);
EXEC (@sql);

posted @ 2024-10-23 19:54  zhaoguanhao  阅读(1)  评论(0编辑  收藏  举报