Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    29

    Question Unanswered: Quote encapsulate output during BCP export to csv file

    I'm exporting from a View using the bcp utility. I have the -t switch set for comma delimited. My first 3 columns are integers, but the rest of my columns need to be wrapped in double quotes because some of the string data contains commas. I can't find a simple way to do this, although I keep coming across notes about format files without any good examples.

    Help?

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    You can specify a different char to be the delimiter with the -t flag, such as tab (the default) or |, or any other char you like.

  3. #3
    Join Date
    Feb 2004
    Posts
    29
    I'm already specifying -t,

    I need this file to be comma delimited.

  4. #4
    Join Date
    Aug 2005
    Posts
    6
    I realize I'm only a couple of years late on this one. ;-) Better late than never...

    Create a query using QUOTENAME(column,'"') on the columns you wish to encapsulate and use the QUERYOUT option of BCP. Keep the -t parameter just as you have it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •