Occasional Deadlock.
- by Carl Robinson
Im having trouble with a web application that will deadlock occasionally
There are 3 queries involved. 2 are trying to update a table
UPDATE AttendanceRoll
SET ErrorFlag = 0
WHERE ContractID = @ContractID
AND DATEPART(month,AttendanceDate) = DATEPART(month,@Month_Beginning)
AND DATEPART(year,AttendanceDate) = DATEPART(year,@Month_Beginning)
and one is trying to insert into the table
INSERT INTO AttendanceRoll
(AttendanceDate, ContractID, PersonID,
StartTime,
EndTime,
Hours, AbsenceReason,
UpdateCount, SplitShiftID, ModifiedBy, ModifiedDate)
SELECT
@P33, @P34, @P35,
CONVERT(datetime,REPLACE( @P36 ,'.',':')),
CONVERT(datetime,REPLACE( @P37 ,'.',':')),
@P38, @P39,
@P40, 1, @P41, GETDATE()
The deadlock graph shows a kind of circular arangement of page locks and an exchange event and the 2 update queries have the same server process id.
If anyone has any ideas about how I should go about solving this issue it would be most appreciated.
I have the deadlock graph that I can post if anybody needs to see it.
Thanks
Carl R