Who’s locking up those tables?

Here’s a simple query that reports SQL Server locks along with the program name, host, sql process id, and the user that went off to lunch in the middle of their transaction… 


select * from sys.dm_tran_locks l
join sys.dm_exec_sessions s on l.request_session_id = s.session_id
join sys.sysobjects o on l.resource_associated_entity_id = o.id


Leave a Comment