I think I understand the basics of what causes deadlocks but I keep having a deadlock on this update statement and I can't understand why or how to fix the problem. Any insights would be much appreciated!
UPDATE player
SET money = money + a.salary
FROM #wages a (NOLOCK), player b (NOLOCK)
WHERE a.playerID = b.playerID
The temp table #wages is populated as needed with playerID and salary columns.
I thought this update would only lock the single resource (player) and so I'm not understanding how it could cause a deadlock.
There's constant activity against my player table by other activity but there is definitely no other activity for #wages because it is created within this stored procedure.
*very confused*
UPDATE player
SET money = money + a.salary
FROM #wages a (NOLOCK), player b (NOLOCK)
WHERE a.playerID = b.playerID
The temp table #wages is populated as needed with playerID and salary columns.
I thought this update would only lock the single resource (player) and so I'm not understanding how it could cause a deadlock.
There's constant activity against my player table by other activity but there is definitely no other activity for #wages because it is created within this stored procedure.
*very confused*