CREATE TABLE TestData
(
data int
)

DECLARE @rows INT
SET @rows = 10000
WHILE @rows > 0
BEGIN
INSERT INTO TestData VALUES (@rows)
SET @rows = @rows - 1
END

DECLARE @blockSize INT
SET @blockSize = 10
DECLARE @rcount INT
SET @rcount = 1
WHILE @rcount > 0
BEGIN
DELETE TestData WHERE data > 500
SET @rcount = @@ROWCOUNT
END
a
b
c
d
