bcp / bulk insert: strings with quotes - field length problems

  • I have quite a few large csv files that I'm trying to upload using bcp. These files are well structured, and I have used bcp to generate a format file for uploading them.

    My problem is, the string fields in my csv file are quoted eg: "qwert", so, when the field is defined as 5 chars long, bcp loads it as "qwer - and so the rest of the record gets out of sync.

    I dont want to load it as 7 characters and then strip out the quotes because we are talking quite a few million rows here, and I'm a bit short of time.

    Any suggestions? Thanks.

  • Modify your format file so that the field delimiters includes the quote character, like "," instead of just ,

    Hope this helps



    Mark

  • In order to use "," as a delimiter in my format file on a Unix system, I had to enter it like this: "\",\""

    In other words I had to "escape" the inner quotes so the format file syntax didn't think it was part of the format file's normal double quotes that surround the delimiter.

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

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