October 31, 2012 at 10:35 am
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
October 31, 2012 at 10:58 am
Look up coalesce
select coalesce(col1,col2,col3) from t1
***The first step is always the hardest *******
October 31, 2012 at 11:22 am
You rock! Can't believe I didn't think to do that.
Working great now. 😀
November 4, 2012 at 2:36 pm
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