sqlservice 结束死锁进程语句
1、悲观锁小实验
declare @sql int
begin tran
select @sql=temp.Amount from temp with(updlock)
waitfor delay '00:00:03'
update temp set Amount=Amount-1 where id=1
update temp set Amount=Amount-1 where id=1
commit tran
select * from temp
--查询死锁进程语句
select
request_session_id spid,
OBJECT_NAME(resource_associated_entity_id) tableName
from
sys.dm_tran_locks
where
resource_type='OBJECT'
--结束死锁进程语句
kill spid
posted on 2023-03-09 17:05 pubilcTreat 阅读(51) 评论(0) 编辑 收藏 举报