commas in address fields and exporting csv files

  • Hi,

    Just wanting to hear peoples experiences in dealing with commas in fields (mainly address fields) which, if left alone, may shift columns when exporting in csv format.

    Do you leave them in the dB and deal with the problem when exporting or maybe replace each occurence in the dB with a space, or delete them. Same goes for apostrophes (') screwing up dynamic queries.

    Any comments?

  • What are you using to do the export?  If you are using BCP and use \" to enclose text fields in quotes in the format file, you should have no problem with anything except embedded double quotes.  Commas and apostrophes will not be a problem.  If you use tab delimeted fields instead of CSV, you won't have a problem with any characters other than embedded tabs and most folks just don't embed tabs in fields.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

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

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