ConditionalValuesFromAnExpression
Last changed: DarrenSQLIS

.

In c# we have the following construct

 switch (expression)
 {
   case constant-expression:
      statement
      jump-statement
   [default:
      statement
      jump-statement]
 }

In SQL Server we have this

Simple CASE function:

 CASE input_expression 
     WHEN when_expression THEN result_expression 
    [ ...n ] 
     [ 
    ELSE else_result_expression 
     ] 
 END 

Searched CASE function:

 CASE
     WHEN Boolean_expression THEN result_expression 
    [ ...n ] 
     [ 
    ELSE else_result_expression 
     ] 
 END

So what is the equivalent in the expression editor in SSIS?

 boolean_expression?expression1:expression2

An example would be:

If the value of a variable is "Red" then we want the expression to take the value of "It Is Red" else we want the expression to be "It Is Not Red"

 @[User::MyVariable] == "Red" ? "It Is Red" : "It Is Not Red"
SeeAlso Expressions