sqlserver2005里查询当前锁的状态。

select t1.* ,t2.name from sys.dm_tran_locks t1
inner join sys.tables t2
on
t1.resource_associated_entity_id = t2.object_id

where resource_type = 'OBJECT'



sys.dm_tran_locks:所有锁的信息
sys.tables:所有表的信息

主要可以查询锁的类型,状态。
原文地址:https://www.cnblogs.com/si812cn/p/865297.html