Monday 16 May 2016

FIND THE TABLE WHICH HAS ROW LOCK (UPDATE/INSERT)

AS SALAMO ALAIKUM WA RAHMATULLAH

The follwoing Query publish Table name which has Row Lock due to not commit the transaction.

select
  object_name(resource_associated_entity_id) as 'TableName' ,*
from
  sys.dm_tran_locks
where resource_type = 'OBJECT'
  and resource_database_id = DB_ID()

MA ASALAAM
--
Passion 4 Oracle

2 comments:

  1. Very useful script to find out query which is responsible for the deadlock issue, specially when you have multiple queries running in the queue of a SQL Server instance...

    Keep up the good work....!!!

    ReplyDelete