How to Identify Locked Table in SQL Server?

Published on by LakshmiSaahul,Dhana Royal

SQL SERVER – How to Identify Locked Table in SQL Server?

Here is a quick script which will help users to identify locked tables in the SQL Server.

SELECT
OBJECT_NAME(p.OBJECT_ID) AS TableName,
resource_type, resource_description
FROM
sys.dm_tran_locks l
JOIN sys.partitions p ON l.resource_associated_entity_id = p.hobt_id

Advertising
To be informed of the latest articles, subscribe:
Comment on this post