DECLARE @newId bit DECLARE MyCur CURSOR FOR SELECT . FROM x OPEN MyCur FETCH NEXT FROM MyCur into @newId WHILE(@@FETCH_STATUS=0) BEGIN UPDATE.. SET .. WHERE...@newId END CLOSE MyCur DEALLOCATE MyCur