code_junkie

Occasional Deadlock

Nov 12th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. UPDATE AttendanceRoll
  2. SET ErrorFlag = 0
  3. WHERE ContractID = @ContractID
  4. AND DATEPART(month,AttendanceDate) = DATEPART(month,@Month_Beginning)
  5. AND DATEPART(year,AttendanceDate) = DATEPART(year,@Month_Beginning)
  6.  
  7. INSERT INTO AttendanceRoll
  8. (AttendanceDate, ContractID, PersonID,
  9. StartTime,
  10. EndTime,
  11. Hours, AbsenceReason,
  12. UpdateCount, SplitShiftID, ModifiedBy, ModifiedDate)
  13. SELECT
  14. @P33, @P34, @P35,
  15. CONVERT(datetime,REPLACE( @P36, '.', ':')),
  16. CONVERT(datetime,REPLACE( @P37, '.', ':')),
  17. @P38, @P39,
  18. @P40, 1, @P41, GETDATE()
  19.  
  20. for (;;) {
  21. try {
  22. using (var t = BeginTransaction()) {
  23. DoTheCall();
  24. t.Commit();
  25. return;
  26. }
  27. }
  28. catch (SqlException ex) {
  29. if (ex.Number != 1205 && ex.Number != 601 && ex.Number != 605)
  30. throw;
  31. }
  32. }
Add Comment
Please, Sign In to add comment