SQL Server2008R2 死锁进程杀掉处理

select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName 
from sys.dm_tran_locks where resource_type='OBJECT' AND OBJECT_NAME(resource_associated_entity_id)='A16_allperinfo'


declare @spid int 
Set @spid = 1721 --锁表进程
declare @sql varchar(1000)
set @sql='kill '+cast(@spid as varchar)
exec(@sql)

 

posted @ 2021-02-21 10:35  violety  阅读(346)  评论(0编辑  收藏  举报