Search code examples
ssis-2012

Nested IF THEN ELSE Operator in SSIS Derived Column


I have an excel which I am trying to load in to a table in my database. The excel file has a column called 'Location Code'. I am using a derived column in my SSIS package to fullfill the condition

If 'Location Code' = "NULL" OR If 'Location Code' ISNULL OR If 'Location Code' = "" then 'Location Code' else "5"+""+'Location Code' //(concatenating '5' with the Location Code).

How do I achieve the above in my derived column?


Solution

  • I finally found the answer to my question. Below, I have provided the exact syntax:

    (DT_WSTR,50)[Location Code] == "NULL" || ISNULL([Location Code]) || (DT_WSTR,50)[Location Code] == "" ? (DT_WSTR,50)[Location Code] : (DT_WSTR,10)5 + (DT_WSTR,50)[Location Code]