• first of all i was NOT looking for a specific solution. So your comment, and snarkyness are not appreciated, nor warranted.

    I was indeed looking for a pattern of behavior to apply, to a problem i have, which this problem is a very minor piece of the whole problem that i'm trying to solve.

    I was already using a coalesce statement with a select to generate the column list, and the solution wasn't to put the entire set of code here, and ask that it be tore apart. (FYI: another part is a crosstab using said column list, but that is outside of what i'm asking, which works awesome btw). Mainly because the problem that I asked about here can be stated simply.

    What is the best way to deal with a set of rows and determine/return the first occurance of a non-zero column value in each row, using a set of column fields that are determined at runtime?

    There should be a 'best-practice' on this, i would think, maybe not.

    in any case.... there should be a pattern of behavior in assessing and attempting to solve, that doesn't rely on specific data.

    So datasets were 'extra' and unnecessary, even though I provided in the second post.

    Can anyone else help?