• Since you are doing this in dynamic SQL, you should also be capable of writing the dynamic SQL to create a variable for each column your are selecting from, and to populate them. Off the top of my head, I can see this leading to multiple dynamic SQL executions with you storing variables in a table to pass between steps. This seems overly complex, so let me ask a few questions:

    1.) First question is why do you feel you need to do this? What are you going to do with those variables once you have them? You already have the values available in the temp table. There is probably a simpler way to achieve your ultimate goal.

    2.) Does the temp table contain only one row?

    3.) Could you please post up a sample of both the query and some data?

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills