tags:

views:

154

answers:

1

I have a data flow with a derived column. I want to convert the contents of a column using an expression as follows:

If the source value is 101 convert it to 1001
If the source value is 102 convert it to 2002
If the source value is 202 convert it to 2019
Etc.

It seems like a Switch/Case statement would be ideal here. Do SSIS expressions support a Switch/Case? If not, what is the best way to handle something like this?

Thanks.

+1  A: 

You can use nested conditionals like this (but it gets cumbersome quickly)
(sourcecolumn == 101)?1001:(sourcecolumn == 102)?2002:(sourcecolumn == 202)?2019:sourcecolumn

This translates roughly to nested if statements

if source value = 101 then 1001
else if source value = 102 then 2002
else if source value = 202 then 2019
else source value

William Todd Salzman

related questions