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

BCP Out file with double quotes

Status
Not open for further replies.

jeffwest21

IS-IT--Management
Apr 4, 2013
60
0
0
GB
I am trying to output a table using BCP in a stored procedure, problem i am having is that I don't get a double quote at the start of the file, and get one on the last line in the file, like below

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

This is what I am using to bcp
Code:
select @sql = 'bcp "select * from Database.dbo.Table " queryout '+ @file +'  /c -t \",\" -r \n\" -T -S' + @@servername
exec xp_cmdshell @sql
print @sql

If anyone can help me see what is wrong with this i would be really grateful.



'Clever boy...'
 
I thin it is something like
select @sql = 'bcp "select * from Database.dbo.Table " queryout '+ @file +' /c -t "\",\"" -r \n\" -T -S' + @@servername
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top