SQLIS Wiki
User: Guest
Login
Wiki Home Wiki Home
Topic Index Topic Index
Edit Edit
Print View Print View
What's New What's New
Search
RSS 2.0 RSS 2.0
Recent Topics
ConditionalValues... ConditionalValues...

Current Version:
7/19/2006 5:16 AM DarrenSQLIS
Conditional Values From An Expression
.

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
Copyright © 2001-2005 SQLDTS.com. All Rights Reserved. TermsOfUse, Powered by FlexWiki 1.8.0.1677