Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Export Data in Text File Using BCP Expand / Collapse
Author
Message
Posted Friday, February 6, 2009 2:43 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, May 16, 2016 9:27 PM
Points: 544, Visits: 70
Comments posted to this topic are about the item Export Data in Text File Using BCP
Post #651467
Posted Wednesday, February 11, 2009 1:03 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, September 23, 2016 10:58 PM
Points: 939, Visits: 2,339
Good article. One suggestion would be to use the pipe character ( | ) as the default separator. Some people and place names have embedded commas. Some countries use commas as decimal separators.

Keep up the good work. Nice job.


ATB

Charles Kincaid

Post #655181
Posted Wednesday, February 11, 2009 4:09 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, September 12, 2016 11:41 AM
Points: 241, Visits: 2,562
Thanks for the quick and simple overview of how to use BCP with xp_cmdshell from within an SP.
Question: Are there any options to delimit text values? I'd like to use BCP to produce 'csv' files, however some of my data has commas and line-feeds/carriage-returns in it: I'd need to double-quote data those values...
Thanks,
Mark


Mark
Just a cog in the wheel.
Post #655312
Posted Sunday, February 15, 2009 10:56 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, May 16, 2016 9:27 PM
Points: 544, Visits: 70
Hi Mark,
There is no option available in bcp to delimit the some field value into double-quote but you can you double-quote for all the field values.

Thanks
Manish Mathur
Post #657486
Posted Monday, February 16, 2009 1:16 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, September 12, 2016 11:41 AM
Points: 241, Visits: 2,562
manish.mathur (2/15/2009)
Hi Mark,
There is no option available in bcp to delimit the some field value into double-quote but you can you double-quote for all the field values.

Thanks
Manish Mathur


Yeah, that's what I thought.. Oh well.

Thanks for the reply!!

Mark


Mark
Just a cog in the wheel.
Post #658046
Posted Wednesday, August 5, 2009 10:59 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, August 30, 2016 1:19 AM
Points: 12, Visits: 146
I am running the procedure and getting error:
SQLState = S0002, NativeError = 208
Error = [Microsoft][SQL Native Client][SQL Server]Invalid object name 'EMS.dbo.tblBilling'.
SQLState = 37000, NativeError = 8180
Error = [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared.

Please guide
Regards:
Abdul Rahman
Post #765955
Posted Tuesday, August 11, 2009 9:42 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, September 6, 2016 1:31 AM
Points: 39, Visits: 16

There is no option available in bcp to delimit the some field value into double-quote but you can you double-quote for all the field values.


Hi There, in your post you mentioned that there is a way to double quote all fields in BCP, could you tell me how to achieve this please, as I am struggling to find anywhere that tells me.

cheers
Post #768739
Posted Wednesday, April 20, 2011 10:49 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 6:12 AM
Points: 472, Visits: 956
Apparently this sp depends on being able to remotely access SQL Server. As I'm running the express version it won't allow the connection. According to BOL neither will the Developer Edition
http://support.microsoft.com/kb/914277
Post #1096493
Posted Thursday, April 21, 2011 6:31 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, February 26, 2016 7:31 AM
Points: 90, Visits: 231
Good stuff, and timely for me since I've been working on moving 10GB of data to a remote location. After waiting 1.5 hours using an INSERT/SELECT I realized it wasn't going to work. I want this job to be automated on a daily basis and was wondering if you had a ready-made, magic script that would import the txt file into another database on the other end?







Wallace Houston
Sunnyland Farms, Inc.

"We must endeavor to persevere."
Post #1096933
Posted Monday, May 16, 2016 7:22 AM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 7:20 AM
Points: 8,084, Visits: 809
Thanks for the script.
Post #1786524
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse