Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am using transactions to perform operations at the back end using Sqlserver 2005.
If deadlock error occurs(i.e) Error number is returned as 1205 will that deadlocked transaction be rolled back or that particular transaction will fail.

SQL
Begin Try
begin Transaction Save

Update Table1  -----Executed Process
Update Table2  -----Deadlocked Process

Commit Transaction Save
End Try

Begin Catch	

if(ERROR_NUMBER() <> 1205)
    RollBack Transaction

End Catch	


Here in the above transaction if Table1 gets updated successfully and Table2 is deadlocked then will both the update DML statements fails or the Second DML Statement fails.

I need a solution for this.
Helpers are appreciated...
Posted
Updated 16-Feb-15 0:01am
v2

1 solution

This will probably help to resolve your issue. SQL SERVER - How To Handle Deadlock

hope its helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900