cancel
Showing results for 
Search instead for 
Did you mean: 

Find record_id reported by sa_report_deadlocks

thomas_duemesnil
Participant
2,219

Hello

I have setup a event to log deadlocks. I recognize that sa_report_deadlocks() returns a object_id and record_id. With the object id I can identify the base table.

But how can I find the row in question ?

Kind regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Breck_Carter
Participant
0 Kudos

Here's a WAG: try ROWID() as in...

   SELECT * FROM DBA.t WHERE ROWID ( t ) = [record_id value];

Caveat Emptor: I have not tried that particular logic with sa_report_deadlocks(), but Foxhound displays a similar query for you to use with the sa_locks() row_identifier column; see the Locked Row Query: field here...

VolkerBarth
Contributor
0 Kudos

As the record_id column within sa_report_deadlock() is declared as "The row ID of the associated row.", I would think the ROWID() system function will help. Here's a similar sample for the sa_locks() output:

SELECT * 
  FROM sa_locks() S JOIN GROUPO.Employees WITH( NOLOCK ) 
     ON ROWID( Employees ) = S.row_identifier 
  WHERE S.table_name = 'Employees';
thomas_duemesnil
Participant
0 Kudos

I have checked my last deadlog entry and the record_id is not actually in the table. The table in question is a log table where I write only. So the record of the winner of the deadlock situation should be there. I will check when the next event happens if that can match.