Search code examples
if-statementssiscasederived-column

SSIS-convert IF and ELSE statement or Case When statement in SSIS derived column expression


SSIS-convert IF and ELSE statement or Case When statement in SSIS derived column expression. An assumption here is, User exist in both system in SAP and Salesforce the email for that user would be same and we can populate any emailid but if the user is only present in either of the two systems we want to populate that in the target table. How to write that is SSIS derived column expression.

For Example:

Case when Salesforce_Email==SAP_Email then Salesforce_Email
     When ISNULL(Salesforce_Email) AND NOT ISNULL(SAP_Email) then SAP_Email
     When NOT ISNULL(Salesforce_Email) AND ISNULL(SAP_Email) then Salesforce_Email
else NULL

OR

Email=IF(NOT ISNULL(Salesforce_Email),Salesforce_Email,Elseif(NOT ISNULL(SAP_Email),SAP_Email,NULL))

Solution

  • These are the basics of SSIS...

    In short: use Conditional from Operaters in Derived Column Transformation Editor:

    «boolean_expression» ? «when_true» : «when_false»
    

    For CASE implementation you have to use "multi level" Conditional...

    «boolean_expression» ? «when_true» : («boolean_expression» ? «when_true» : «when_false»)