Tuesday, April 7, 2015

Text-Qualifier only to the values which has a comma(seperator) in it

We generally get requirements to load data to a flat file destination or csv files.
When we load such data, we may see that value itself has a comma or a separator in it.

During such cases we usually specify text-qualifier in the flat file connection manager properties.
Whenever we specify text-qualifier like that, all column values have these text-qualifier, irrespective of whether the value has a comma in it or not.

InCase, if the customer asks us to text-qualify only to those values which has a comma in it, then below is the work-around solution for that.
Take a derived column transformation and add the below expression:

(FINDSTRING(column_name,",",1) == 0) ? column_name : "\"" + column_name+ "\""
 

No comments:

Post a Comment