• Code solutions depends on a number of things. First, it would be helpful to see the actual table descriptions.

    Second, I'd want to know the scope of record volumes, in other words, how many records are you processing?

    None the less this can be done using either temporary tables, table variables or one or more CTEs. No reason to be processing row by row regardless how many records you are processing.

    Kurt

    Kurt W. Zimmerman
    SR DBA
    Lefrak Organization
    New York, NY

    http://www.linkedin.com/in/kurtwzimmerman