0

I have a field called something like TYPE & the values are variant in it. I want the SSIS to export the result to CSV & while exporting, if it finds the , in column TYPE only that line/value should be double quoted. Eg:

TYPE Begin Bag 1,000 mL Miscellaneous 20ml Final 2,000 mL Begin Bag 1 mL

the result should be (in the csv format exported): TYPE "Begin Bag 1,000 mL", Miscellaneous 20ml, "Final 2,000 mL", Begin Bag 1 mL

I tried using the Derived column "\""+ TYPE +"\"" but that just adds Double quotes to every value for column TYPE.

Please help!

THanks, Atulya

Atulya
  • 1
  • 1
  • 1

1 Answers1

1

You should be able to use SSIS CASE syntax in your derived column node as follows:

FINDSTRING(TextLine,",",1) > 0 ? "\"" + TextLine + "\"" : TextLine

The expression basically says - if a comma is found in TextLine, THEN wrap it in double quotes ELSE just keep Textline

enter image description here

Scott Hodgin - Retired
  • 24,062
  • 2
  • 29
  • 52