Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bcp out to a csv file with quoted values

Status
Not open for further replies.

KCWMS

MIS
Mar 25, 2004
38
0
0
US
using sql server 2k sp2

using master.dbo.xp_cmdshell 'bcp ... ' I can output a query to a text file (csv) with only one problem. I need the values to be wrapped in quotes like this
Code:
"1","me","you"
"2","he","she"
I currently get
Code:
1,me,you
2,he,she

I am so close. Please tell me that there is a argument I am over looking!!

Thanks in advance

Kevin
 
Are you using format file to export the data from bcp? You can define quotes on the format file.

Thanks
sqlhelp.blogspot.com
 
nomadicalloy,

I have read the BOL and created a format file (interactively) and that works fine... but I do not see anything that specifies how I can wrap values in quotes.

I could alwasy build a query that does this. Is that the only option?

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top