Monday, June 9, 2008

Assign default values in Derived Column Transformation


Our requirement demands us to create two new locations and hard code the value to the incoming record within the data flow, so we go in for Derived Column Transformation which fits the bill. How do we assign Campsie to location 1 and Campbelltown to location 2. We create two new columns and Loc1 and Loc2 (add as new columns) and in the expression and input the default values that has to be assigned within double quotes. Eg: "Campsie". SSIS by default suggests us the data type and the length, which can be changed to match our destination's data type.
Do not assign with arithmetic operator like == "Campsie", this will throw a whole heap of errors. The other way of accomplishing the same would be by setting this default value to a SSIS variable and calling it here in the expression editor.

Tried a different combinations, like single quotes, paranthesis before / after the string etc., to get this right.