I\'m not sure if this is something I should do in T-SQL or not, and I\'m pretty sure using the word \'iterate\' was wrong in this context, since you should never iterate any
You can use a temp table or table variable with an additional column:
DECLARE @MyTable TABLE (
Column1 uniqueidentifer,
...,
Checked bit
)
INSERT INTO @MyTable
SELECT [...], 0 FROM MyTable WHERE [...]
DECLARE @Continue bit
SET @Continue = 1
WHILE (@Continue)
BEGIN
SELECT @var1 = Column1,
@var2 = Column2,
...
FROM @MyTable
WHERE Checked = 1
IF @var1 IS NULL
SET @Continue = 0
ELSE
BEGIN
...
UPDATE @MyTable SET Checked = 1 WHERE Column1 = @var1
END
END
Edit: Actually, in your situation a join will be better; the code above is a cursorless iteration, which is overkill for your situation.