Execution of sequential delete and uncommitted read
3
votes
1
answer
3415
views
We are running the following queries using dynamic SQL, which is erroring out for few cases when we run concurrent instances. The error is:
>*Could not continue scan with NOLOCK due to data movement...*
This question says this error is thrown when a process reads data which is being deleted by another process. Our process is deleting and reading the same rows, however one after the other as per following query (the
SELECT
is after the DELETE
):
DELETE FROM Table1
WHERE colum1 = somevalue1
AND column2 = somevalue2
SELECT COUNT(*)
FROM Table1 WITH (NOLOCK)
WHERE colum1 = somevalue1
AND column2 = somevalue2
I am trying to understand the execution of above query. As the SELECT
is uncommitted, does it start executing before the DELETE
is committed? Would this mean that removing the NOLOCK
hint would stop the error?
Asked by kanu
(117 rep)
Feb 17, 2013, 06:36 PM
Last activity: Nov 18, 2019, 12:28 PM
Last activity: Nov 18, 2019, 12:28 PM