Question on Writing an Expression in Derived Column -SSIS(2008)

  • 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..............

  • 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]

  • Have a look here[/url].

    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

  • 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

  • what should the expression return if ColA is not null? if the desired result is ColA, then how about

    COALESCE(ColA,ColB,ColC,'Other')

  • WILLIAM MITCHELL (7/25/2012)


    what should the expression return if ColA is not null? if the desired result is ColA, then how about

    COALESCE(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