★ SSIS: Returning NULL in a conditional statement

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.

One thought on “★ SSIS: Returning NULL in a conditional statement

  1. 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

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s