Nested conditional derived column based on NULL values in data flow

  • Hey all,

    In my data flow I am performing a select from a database that returns Column1, Column2, column3, Column4. Any of these columns may contain an EmployeeID. The problem is they are not populated consistently. So my logic needs to check each column starting with column1 to determine if it is null. If it is NULL then we move on to the next column. The first column that isn't null becomes my derived column value. If all columns are NULL for that ROW then Column1 becomes the value of the derived column. I am trying to do this with a nested ? : expression but not having much luck.

    Anyone out there have good example how to do this or perhaps a simpler way of accomplishing the same thing?

    Thanks in advance!

    Eric

  • Look up coalesce

    select coalesce(col1,col2,col3) from t1

    ***The first step is always the hardest *******

  • You rock! Can't believe I didn't think to do that.

    Working great now. 😀

  • thanks i think you should tell my boss that

    ***The first step is always the hardest *******

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply