August 7, 2012 at 12:37 pm
Hi,
we encountered a deadlock in production now.
we have two batch jobs.
one batch job tried to update the table1 with error number
at the same time
and another one is tried to update same row in table1
and they deadlocked on each other.
can we use ROWLOCK in both the places? is there any database setting that does that for us instead of having to do this in every query? Please advise.
we are using IDERA SQL monitoring tool.
August 7, 2012 at 1:25 pm
Did you try Update Lock.
August 7, 2012 at 4:16 pm
There is more to what you are asking that you haven't told us. If two processes are attempting to update the same record, you should get one process being blocked, not deadlocked.
For a deadlock the two processes are both waiting on the other to release a lock on a resource the other needs beofre continuing.
Time 1 -- Process 1 locks Resource A Process 2 locks Resource B
Time 2 -- Process 1 attempts to lock Resource B Process 2 attempts to lock Resource A
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply