BCP

  • HI i am trying to use xp_cmdshell to execute som BCP commands. I am able to get data out of the tables into flat files. I would want to know about a way i can put Varchar data between quotes in the file.

    This is because if there is a ',' or a '/ 'in these data it is skipped with an error when i try to BCP them into anothe table.

    Any help is appreciated.

  • Change the delimiter to something that will not occure in ur data (|, ~ etc). I dont think you can enclose a varchar field with double quotes and even if you do so, the bcp will keep failing as far as it finds a delimiter char within import/export data.

  • Since you're using bcp for both export and import use bcp native type/data format (-n) rather than delimited/text (-c) for your file format and you should be fine regardless of the content of your varchar columns.

     

     

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

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