SQLserver 表锁住已经锁住表所执行的语句

---查找锁住的表已经相关的进程

select object_name(resource_associated_entity_id) as tableName, request_session_id as pid from sys.dm_tran_locks
where resource_type = 'OBJECT' and object_name(resource_associated_entity_id) ='T_Purchase_Detail'
---查看锁住的进程执行的语句
DBCC INPUTBUFFER (402)

原文地址:https://www.cnblogs.com/ziteng1807/p/13730303.html