Returned SQL Results

  • Good Morning. I have problem with my results output. I return it to grid, click on the corner of the results pane and "Save Results As" and save to a .csv file. The problem lies in the last field returned - it is a text datatype. All data has double quotes around the values.

    If the last field has text with a semicolon, it creates a new line in the output .csv file. For example data in the table looks like:

    "Term: Fall 2009 Subject: EDCI; Course: 257 Sensory Motor Sec: LL; Will Use Calendar"

    causes this in the .csv file

    "Term: Fall 2009 Subject: EDCI;

    Course: 257 Sensory Motor Sec: LL;

    Will use Calendar"

    Would not be an issue with a small resultset but I am looking at 100K +

    You ideas or solutions would be very much appreciated.

  • Try using a replace.

    replace('"Term: Fall 2009 Subject: EDCI; Course: 257 Sensory Motor Sec: LL; Will Use Calendar"',';','-')

    or some character that will not cause you the grief.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Thank you. It was actually the line break/carriage return in the field.

    I used...

    REPLACE(col, CHAR(13) + CHAR(10), '')

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

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