July 23, 2012 at 10:56 pm
Hi All,
I have Three Columns Like
ColA,ColB,ColC
I need to write an expression in derived column, conditions are
If(ColA ISNULL then ColB)
If(ColB ISNULL then ColC)
If(ColC ISNULL then "Other")
How to write above condition in an Expression which i can use it in Derived Column ?
Thanks In Advance..............
July 24, 2012 at 1:41 am
Here Are The Answers From (MSDN Forum) :
you can use conditional operator and isnull to build your expression for example:
ISNULL(ColA)?(ISNULL(ColB)?(ISNULL(ColC) ? "Other" : ColC):ColB):ColA
or
Derive an expression like this..
ISNULL( [Column 0] )?(ISNULL( [Column 1] )?(ISNULL( [Column 2] ) ? "Other" : [Column 2] ): [Column 1] ): [Column 0]
July 24, 2012 at 1:41 am
You need a nested if...then construction along the lines of
IsNull(ColA)? (IsNull(ColB)? ColC: ColB) : ColA
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 24, 2012 at 1:42 am
Beat me! And I missed the IsNull on ColC, oops.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 25, 2012 at 7:00 am
what should the expression return if ColA is not null? if the desired result is ColA, then how about
COALESCE(ColA,ColB,ColC,'Other')
July 25, 2012 at 7:18 am
WILLIAM MITCHELL (7/25/2012)
what should the expression return if ColA is not null? if the desired result is ColA, then how aboutCOALESCE(ColA,ColB,ColC,'Other')
COALESCE is not an SSIS function, unfortunately.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply