How can I create a while loop in SQL and grab a certain field from my table and work with each record.
Example,
While @Var > 1
BEGIN
Select @FieldValue = somefield from mytable for current record in my loop
Then I can do some stuff here based on @FieldValue
then it loops to the next record
Start Free Trial