TheBugSlayer
Programmer
Happy New Year all.
I have a few queries in the form
in a stored procedures. Very often the execution of this SP, which runs every ten minutes, creates deadlock with either the SP or the other programs being chosen as the victim. These tables are heavily used by the most important applications. The SP is the only one that updates the field it does. I with to be able to read the table rows, even if they are being locked by other applications, and I would like to allow the other applications to read the rows that this SP is updating.
I have modified the query by adding hints like this:
My intention is to read all records that I need to modify, even is at the time they were locked by another transaction (that may complete by the time mine is ready to update them), and since I am not modifying the joining table and no other process will modify the same field as the SP, AND to select all rows that I need from the joining table.
Do you know a better way to achieve what I want?
Thank you.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
I have a few queries in the form
Code:
update accession
set clientkey=c.id
from accession a
join client c WITH (NOLOCK)
on a.facilityid=c.facilityid
and a.clientid=c.clientid
where a.clientkey is null
I have modified the query by adding hints like this:
Code:
update accession WITH (READPAST)
set clientkey=c.id
from accession a
join client c WITH (NOLOCK)
on a.facilityid=c.facilityid
and a.clientid=c.clientid
where a.clientkey is null
Do you know a better way to achieve what I want?
Thank you.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)