SSIS Expressions - EvaluateAsExpression Problem
Posted
by Randy Minder
on Stack Overflow
See other posts from Stack Overflow
or by Randy Minder
Published on 2010-03-01T20:43:29Z
Indexed on
2010/03/23
7:03 UTC
Read the original article
Hit count: 197
ssis
In a Data Flow, I have an Derived Column task. In the expression for one of the columns, I have the following expression:
[siteid] == "100" ? "1101" : [siteid] == "110" ? "1001" : [siteid] == "120" ? "2101" : [siteid] == "140" ? "1102" : [siteid] == "210" ? "2001" : [siteid] == "310" ? "3001" : [siteid]
This works just fine. However, I intend to reuse this in at least a dozen other places so I want to store this to a variable and use the variable in the Derived Column instead of the hard-coded expression. When I attempt to create a variable, using the expression above, I get a syntax error saying 'siteid' is not defined. I guess this makes sense because it isn't. But how can I get this the expression to work by using a variable? It seems like I need some sort of way to tell it that 'siteid' will be the column containing the data I want to apply the expression to.
© Stack Overflow or respective owner