views:

66

answers:

2

Hi All,

I have a source column with blank (not "NULL"), and target as numeric. while converting using the data conversion it is not converting due to balnk source value so I used derived column to replace a blank value with NULL or 0 as

(source column == " ") ? "0" : source column

but its not giving the value as 0 in the blank place.

thanks prav

+1  A: 

This should do the trick.

(LEN(TRIM(sourceColumn)) = 0 ? "0" : sourceColumn)
Barry
Thanks Barry, The logic worked for my data. it is also working with RTRIM instead of TRIM. thanks prav
praveen
A: 
([source column] == null || [source column].TrimEnd().Length == 0)
     ? "0"
     : [source column]
Anthony Faull