Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 bcp export format

Author  Topic 

alex1979
Starting Member

1 Post

Posted - 2002-05-22 : 02:09:07
hi :) hope u all can help.

im exporting data from database X with table Y to a text file "e.txt".

bcp "SELECT * FROM X..Y" queryout e.txt -U <user> -P <password> -c -t ,

by using this command, the format would be:

field1, field2, field3

here, the column deliter is comma and row delimited is newline.

how can i make the format of the exported file to be as such when using bcp?

"field1", "field2", "field3"

where the the value for each field is inside the "".

thanx


cool baby

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-05-22 : 08:57:09
I don't believe you can w/ BCP. BCP is a very low-level tool that will do basic delimiting but not the "" field escaping that MSFT uses in its CSV format.

No worries though, DTS does export with "" field escaping. you can use dtsrun.exe if you require command-line execution.

quote:

hi :) hope u all can help.

im exporting data from database X with table Y to a text file "e.txt".

bcp "SELECT * FROM X..Y" queryout e.txt -U <user> -P <password> -c -t ,

by using this command, the format would be:

field1, field2, field3

here, the column deliter is comma and row delimited is newline.

how can i make the format of the exported file to be as such when using bcp?

"field1", "field2", "field3"

where the the value for each field is inside the "".

thanx


cool baby



setBasedIsTheTruepath
<O>
Go to Top of Page
   

- Advertisement -