SQLTeam.com | Weblogs | Forums

Conversion


#1

I want to convert the column value to 0 if the value is NULL or empty string in the derived column transformation (SSIS).
Please suggest.


#2

isnull([column]) || [column] == "" ? 0 : [column]


#3

Dunno about SSIS specifically, but "convert value to 0 if the value is NULL or empty string" can be done in SQL as:

IsNull(NullIf(MyColumn, ''), 0)

if there might be trailing spaces then:

IsNull(NullIf(RTrim(MyColumn), ''), 0)