SSIS: Returning NULL in a conditional statement
October 22nd, 2007
I was working with SSIS the other day, and was trying to get to use a Derived Column Transformation to return a NULL value. It should be pretty straightforward, however it seems you have to cast the NULL expression as a NULL value for it to work properly. Rather than using simply:
TRIM(column_name) == “NULL” ? NULL(DT_STR,27,1252) : TRIM(column_name)
I instead had to use:
TRIM(column_name) == “NULL” ? (DT_STR,27,1252)NULL(DT_STR,27,1252) : TRIM(column_name)
Thanks to this blog entry for pointing me in the right direction.
Stumbled upon this one myself. To expand on this anser, one can use the straight NULL(DT_STR,27,1252) by itself, but will have to prefix when in a conditional statement