How to convert blank or empty string or whitespace to null in ADF mapping dataflow

2.2k Views Asked by At

Suppose I have column1 which is having only empty string, now I want to convert it to null.

2

There are 2 best solutions below

1
On
iif(column1=='',toString(null()),column1)
0
On
iif(toString(length(rtrim(Column))) != "0", Column,toString(null()))

Here is the answer to this. I have it working in my ADF. Some columns records are sent in a flat file with empty spaces. This code will trim white spaces, then count the characters and IF 0, then change to NULL. I spent a few days on this working several different approaches and this is the only one that works. SSIS has an option 'Retain NULLs'; ADF should add that feature to Source Files.