如果你是想消除死锁,你可以用:
DECLARE @Timeout int
SELECT @Timeout = @@lock_timeout
SELECT @Timeout
GO
你运行下面的代码:
begin tran
update table2 with (ROWLOCK) set a=a-1 where b=1
EXEC sp_lock
commit tran
GO
你也许会发现有库级共享锁、表级意图独占锁、页级意图独占锁、行级排它 锁
DECLARE @Timeout int
SELECT @Timeout = @@lock_timeout
SELECT @Timeout
GO
你运行下面的代码:
begin tran
update table2 with (ROWLOCK) set a=a-1 where b=1
EXEC sp_lock
commit tran
GO
你也许会发现有库级共享锁、表级意图独占锁、页级意图独占锁、行级排它 锁
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货