Exporting to CSV with (") as text delimiter

  • I am trying to export from SRS to CSV and no matter if the field is text, string, char, or varchar it exports without the (") around the field as a delimiter.  The documentation that I have read says that it should as a default delimit text/string fields with (").

    If I export to CSV I get this:

    TextField, NumberField, TextField

    I would like to get this:

    "TextField", NumberField, "TextField"   or

    "TextField", "NumberField", "TextField"

    Any ideas on how to achieve this?  I have tried ToString(), CSTR(), CAST and Convert.  Nothing seems to affect it.  I even tried stringing Chr(34) on each end of the field but then I get """TextField""", ...

  • I bet you are not making this mistake, but I once did, so just in case....

    I wrote an export to csv (not from SQL Server), expecting " around the text fields. I then wanted to check the output, and without even thinking about it, chose Excel. That was a smart move. It was a while ago, when Notepad had its 64k restriction, and the file was big. But when I opened it, there was no " anywhere.

    It's amazing how long I can go (and how much code I can stare at, wondering where the error is) before seeing the obvious. Excel doesn't show the " on an automatically imported csv.... big DOH! moment.

    Bill.

  • Bill,

     

    Thanks for the reply.  I am using just a few rows to test the export and opening it in Notepad.  Again, no quotes around text fields.  Very frustrating!

Viewing 3 posts - 1 through 2 (of 2 total)

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