sanjdhiman
Programmer
Hi I am running a simple loop statement that deletes data from a table
however it needs to be ran in a loop.
I need to let it run in a high level of isolation level SERIALIZABLE
WHILE @t <= @Max
BEGIN
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
BEGIN TRAN
DELETE FROM TABLE a
DELETE FROM TABLE y
IF @@ERROR = 0
COMMIT TRAN
ELSE
ROLLBACK TRAN
SELECT @Counter = @Counter + 1
END
That is pretty much the code , yet if I take the DELETE STATEMENTS out of the loop it works fine, but once in the loop it hangs and their is no I/O movement when doing a sp_who2
Can anyone help
thanks?
however it needs to be ran in a loop.
I need to let it run in a high level of isolation level SERIALIZABLE
WHILE @t <= @Max
BEGIN
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
BEGIN TRAN
DELETE FROM TABLE a
DELETE FROM TABLE y
IF @@ERROR = 0
COMMIT TRAN
ELSE
ROLLBACK TRAN
SELECT @Counter = @Counter + 1
END
That is pretty much the code , yet if I take the DELETE STATEMENTS out of the loop it works fine, but once in the loop it hangs and their is no I/O movement when doing a sp_who2
Can anyone help
thanks?