Monday, March 12, 2012

Problem with expression window in derived column

Hi,

i am facing problem to dervie one column value from another column using either if and case statements in expression window of dervived columns transformation.

let me give the exapmle. i get 1 column from source system name as "col a" and i want to insert 2 columns into my destination as col A and col B. based on the values of col A i want to derive the values of col B,like if col A value is 0 then col B value is Good else BAD.

Can any one asssit in this regard how to achive it? and is it possible to use IF and CASE statement in this dervived column tranformation?

Sreenivas

Select the Add New column option, call it ColB or whatever, then use an expression like this -

ColA == 0 ? "GOOD" : "BAD"

This uses the conditional operator, as documented in Books Online - http://msdn2.microsoft.com/en-us/library/d38e6890-7338-4ce0-a837-2dbb41823a37(SQL.90).aspx

Logicaly it reads like this -

If ColA Equals 0 Then

Return "GOOD"

Else

Return "BAD"

End If

No comments:

Post a Comment