Saturday 12 September 2020

Convert Blank Space to Null in Flat file for the specific column values in SSIS

In the previous post we saw “Convert all Blank Space to Null in Flat file SSIS”

https://bageshkumarbagi-msbi.blogspot.com/2020/09/some-time-weget-requirement-that-to.html

Below is the file

Our the requirement is to load the blank value for the column and for the address column if we get the blank value in the file in this case we need to store the db null for this column.

If we set the property

 

It will store db null for all blank spaces in the db. See the previous post.

Let’s see how we can convert blank space to null for the specific column value.

Taking drive column transformation and adding the below formula to convert the blank value to db null and then we store this null value into the database.  


(DT_STR,50,1252)(TRIM(Addr) == "" ? (DT_STR,50,1252)NULL(DT_STR,50,1252) : Addr)

Taking the destination as OLEDB destination and mapping the addr column to DC_addr column.

Now we are executing this task.  

Executed successfully.

See the records in the database table. 

Getting the db null value for the specific column.

Popular Posts