If-ElseIf-Else SSIS is somehow returning NULL?

  • Hello -

    I have a derived column with the following code and somehow < 1% of the rows are coming back as NULL. How is this even possible?

    (DT_STR,13,1252)(Code == "123" ? "ABC" : Code == "456" ? "DEF" : Code2 == "789" ? "GHI" : "XYZ")

    If no criteria match, wouldn't it always bring back "XYZ"? I don't wrap my head around NULL is even a possibility!

    Thanks for your assistance!

  • Still stumped on this one...any ideas?

  • Triality (5/11/2012)


    Hello -

    I have a derived column with the following code and somehow < 1% of the rows are coming back as NULL. How is this even possible?

    (DT_STR,13,1252)(Code == "123" ? "ABC" : Code == "456" ? "DEF" : Pharm_Chain_Code == "789" ? "GHI" : "XYZ")

    If no criteria match, wouldn't it always bring back "XYZ"? I don't wrap my head around NULL is even a possibility!

    Thanks for your assistance!

    Make sure that you start with ISNULL(Code) ? "XYZ" : (Code == "123" ? ...

    Good luck with your project!

  • Yep, what Revenant said. You can't evaluate NULL, just like SQL Server. As you have two columns involved in the logic, it might be simpler to have a step above this that replaces NULLS in those two columns with an empty string, so this always evaluates.

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

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