How to use case when in expression in ssis?

L Tune 80 Reputation points
2023-12-29T08:21:44.6633333+00:00

I tried to use case when in my expression but it does not work.

Could you please give me some guide?

SQL Server Integration Services
0 comments No comments
{count} votes

Answer accepted by question author
  1. ZoeHui-MSFT 41,541 Reputation points
    2023-12-29T08:35:15.08+00:00

    Hi @L Tune,

    When selecting data from a database using T-SQL, one can use CASE statements to derive new columns based on data in the database. However, when reading data from files in SQL Server Integration Services (SSIS) there isn't a CASE statement readily available when new columns need to be derived or existing values need to be replaced.

    You may try with

    Field == "TrueCondition1" ? “True” : ( Field == "TrueCondition2" ? “True” : ( Field == "TrueCondition3 " ? “True” : ( Field == "TrueCondition4" ? “True” : “False"  ) ) )
    
    
    

    Or you may refer to https://www.mssqltips.com/sqlservertip/2924/case-statement-functionality-in-sql-server-integration-services-derived-column-transformation/

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.