Reputation: 250
I have this odd deadlock issue which has been bugging me. The scenario is as follows:
As per the photo, the 2nd stored procedure cannot update data for that Tournament Number until it's been first inserted in the table. How is it possible for it to deadlock in this scenario and how can I possibly reproduce it and avoid it?
Thanks.
2nd screenshot:
Upvotes: 1
Views: 289
Reputation: 70513
See comments on main question for pre-amble. The issue here is two tables (A
and B
) in a different order so it happens like this:
B
.A
. then trys to lock table B
but SP2 has it.A
but SP1 has it.deadlock
note: This is basically how every deadlock happens just some complicated fluff around it. It is all about the order you lock the tables and release them. If everything locks and releases in the same order you should never get a deadlock.
Upvotes: 1