Tejasri sai
Tejasri sai

Reputation: 11

What could be the cause for DEADLOCK with two update statements?

I see the deadlock extended event capture two update statements as process which is causing deadlock. Both processes look exactly same.

Process #1:

update CL 
set N1 = @P0, N2 = @P1, N3 = @P2 etc.

Process #2:

update CL 
set N1 = @P0, N2 = @P1, N3 = @P2 etc.

Under resource list I see this:

<keylock hobtid="72057594321698816" dbid="5" objectname="CLINE" indexname="PK_CLINE" 
<keylock hobtid="72057594320584704" dbid="5" objectname="CL" indexname="PK_CL" 

I could get the two rows from the %%lockerss%%

What could be the issue?

Upvotes: 1

Views: 709

Answers (1)

Wouter
Wouter

Reputation: 2976

Do you have some transactions where you update both tables CI and CLINE (in the same transaction)? If you have a transaction where you update first CI and then CLINE and another transaction where you update first CLINE and then table CI, this can cause deadlocks.

Upvotes: 1

Related Questions