loop through a table variable in TSQL without using a cursor
Declare@IdintWhile(SelectCount(*)From ATable Where Processed =0)>0BeginSelectTop1@Id= Id From ATable Where Processed =0--Do some processing hereUpdate ATable Set Processed =1Where Id =@IdEnd