Export csv file with Headers having double quotes but not all data row.

  • I am trying to export a csv file where the header column are all double quote delimited but only the string data has double quotes.  Im not sure SSIS can do this. Any ideas?

    e.g.

    "A String","B String","C Number"

    "abc","def",1

    "bob","builder",4

  • SSIS can do it - you do need to ensure you set the Text Qualifier to Double Quotes

  • I'm not sure that helps me.

    If you notice in my example the 3rd column header has double quotes but the data for column 3 does not.

  • lgegerton wrote:

    I'm not sure that helps me.

    If you notice in my example the 3rd column header has double quotes but the data for column 3 does not.

    I think it will help. Try it,

  • I may have missed something simple, but I don't think this is as straightforward as it should be.

    If you set double quotes as the text qualifier for the flat file connection then all the headers and columns are text qualified, which does not meet the requirement.

    You can edit individual columns in the advanced tab of the flat file connection properties, and set text qualified = false, but this has the knock-on effect of removing the quotes from the column header which also doesn't meet the requirement.

    For each column you set text qualified = false, you can add double quotes around the column name in the flat file properties editor. This then requires that you remap columns in the data flow.

    This does work, but is rather convoluted.  There should be an easier way and maybe there is. I imagine you could export the headers first with overwrite data, and then append the data without column names, but that seems less than ideal too.

    BCP OUT may be the solution. I know it has been suggested previously in response to similar questions.

    • This reply was modified 2 years, 1 month ago by  Ed B.
  • off course it can.

    step 1 - set double quotes as text qualifier

    step 2 - change the "numeric" column name << THE NAME itself>> to have double quotes around it

    step 3 - change that column and set "text qualified = false" on advanced tab

    adding the the quotes to the name can even be done on the source sql used - and that will generate the file with the quotes on those fields required.

     

  • Where and how do you do step 2

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply