Space Ghost

Space Ghost

  • NA
  • 45
  • 0

Looping through each record and modifying

Jul 20 2010 6:43 AM
Hi,

I am a bit stumped with this and cannot find the correct resources. What I want to do is loop through a result set in my stored procedure and change a specific field of each record. With I only want to do this if the record that is currently being check meets certain criteria. Below I will try to put it out more simple.

MyResultset has 10 records in.


WHILE MyResultSet HAS ROWS
BEGIN
   IF RMyResultset.Active = 'True'
      SET RMyResultset.Active = 'False'
   END IF

MyResultSet.MoveToNextRow
END

How can this be achieved to build this in my SQL Stored Procedure?

I hope this explains my scenario well enough.

Thanks,


Answers (1)