Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Transaction Blocking and Preventing Query

Status
Not open for further replies.

gharabed

Programmer
Sep 7, 2001
251
US
This is driving my nuts! I am working in SQL Server 2000 by the way. I have a job that runs that does a large select insert into a table (lets call it A). This typically takes about 45 minutes. I have another job that queries table A but the only way I seem to be able to execute the query while the insert is ongoing is to use the NOLOCK hint. The problem with this is that I am performing dirty reads which I don't want to do. Isn't there some way in SQL Server for the query to only read the commited records in the table and skip the uncommitted records being inserted? I tried using the READPAST hint in the query but when I look, I can see that the insert transaction is blocking the query transaction. I thought that was the whole point of the READPAST hint. Can anybody help. I can't believe that you can't query a table for committed values while another connection/transaction is inserting records. Doesn't SQL Server do row or even page level locking?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top