Find Locked Table in SQL Server
How can we find which table is locked in the database? Please, suggest.
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
When reading sp_lock information, use the OBJECT_NAME( ) function to get the name of a table from its ID number, for example:
There is another proc provided by microsoft which reports objects without the ID translation : http://support.microsoft.com/kb/q255596/