Puede usar sp_lock
(y sp_lock2
), pero en SQL Server 2005 en adelante, esto está obsoleto a favor de consultar sys.dm_tran_locks
:
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