NULLIF in SSIS?

  • Hi everyone,

    I have a sql query:

    SELECT NULLIF('1900-01-01','1900-01-01')

    The result of above query is NULL as expected.

    I am trying to achieve same result in SSIS derived column expression but nothing seems to work. Is there any option to get NULL as result if input column value is the one you dont want..

    Simply I want to know what is NULLIF represented in SSIS?

    Thanks

  • Not sure about SSIS specifically but in T-SQL the following seems to be equivalent afaik and unless it can be proven otherwise 🙂

    select case when '1900-01-01'='1900-01-01' then null else '1900-01-01' end;

    In this case the ELSE condition is never evaluated but it's still necessary (for there to be some expression not specified as NULL) otherwise you get this error

    Msg 8133, Level 16, State 1, Line 17281
    At least one of the result expressions in a CASE specification must be an expression other than the NULL constant.

    • This reply was modified 1 year, 11 months ago by  Steve Collins.

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Steve Collins wrote:

    Not sure about SSIS specifically but in T-SQL the following seems to be equivalent afaik and unless it can be proven otherwise 🙂

    select case when '1900-01-01'='1900-01-01' then null else '1900-01-01' end;

    In this case the ELSE condition is never evaluated but it's still necessary (for there to be some expression not evaluated as NULL) otherwise you get this error

    Msg 8133, Level 16, State 1, Line 17281
    At least one of the result expressions in a CASE specification must be an expression other than the NULL constant.

     

    Thank you for letting me know about this. I also found a solution for SSIS:

     

    Date_of_Birth == "1900-01-01" ? NULL(DT_DBDATE) : (DT_DBDATE)Date_of_Birth

    • This reply was modified 1 year, 11 months ago by  Jobs90312.

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

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