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
 General SQL Server Forums
 New to SQL Server Programming
 Help with bcp export to csv

Author  Topic 

ashgupta
Starting Member

17 Posts

Posted - 2008-12-11 : 22:00:59
Hi all,
I am using
C:\>bcp dbo.tbl_name out c:\test.csv /U**** /P**** /S*** -c -t\"\,

command to export my sql tables to csv.
It does the export alright in this format

DAAC",Yes",",",",",",",No","

However I looking for some help to get this generated in
"DAAC","Yes","","","","","","","No",""

so preceding " as well and if possible to remove the null columns

ideally "DAAC","Yes","No"

Any help welcome

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-11 : 22:39:53
use a format file for specifying the delimiter

www.nigelrivett.net/SQLTsql/BCP_quoted_CSV_Format_file.html
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-12-18 : 06:22:33
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=116388
Go to Top of Page
   

- Advertisement -