• Without seeing the table structure, data, the different calculations that would be completed and what the data would look like when process was completed (the expected results), it is really hard to provide any concrete advise here.

    Personally, I would look for a set-based way to accomplish the task in one pass if at all possible. Break it down if needed, particularly if the divide and conquer would help performance as well as data integrity.