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

1
  • 1
    See this page from the Help Center to merge your two accounts ("Atulya" and "atulya dharmaraj"). Then, you'll be able to accept the answer.
    – RDFozz
    Dec 5, 2018 at 21:27

1 Answer 1

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.