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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Double Quote at start of BCP'd file

Status
Not open for further replies.

jeffwest21

IS-IT--Management
Apr 4, 2013
60
GB
I have an export that is ouputtying some data from SQL using bcp, I need to add quotes around it but everytime it output i miss a double quote at the start and get and extra one at the end.

I am using this
Code:
select @sql = 'bcp "select * from Database.dbo.table " queryout '+ @file +'  /c -t \",\" -r \n\" -T -S' + @@servername

Can anyone see what I am missing to get this working?

'Clever boy...'
 
Show us what you want your final output to be and we can show you how to fix it.

Simi
 
Show us what you want your final output to be and we can show you how to fix it.

Simi
 
This is what I am getting

00008016","30/09/2013 16:31","30/09/2013 16:31
"

This is what I would like

"00008016","30/09/2013 16:31","30/09/2013 16:31"

'Clever boy...'
 
Late to this party, but you have to use a format file to qualify the text output with quotes. Or you could write a view that stuffs the quote mark in the results.

-----------
With business clients like mine, you'd be better off herding cats.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top