BCP out to include field columns names
BCP out to include field columns.
Would be very helpful it the BCP command line tool will have the option to export the field column names
Upvotes: 41<=-=Oct 4 2007 10:13AM=-=>
Thank you for your feature suggestion. We are considering the improvement in our next release.<=-=Jan 23 2012 11:23AM=-=>
It’s been three and a half years, and we’re headed toward our third release since this item was filed, but is this still being considered for “our next release”?<=-=Feb 22 2012 7:56AM=-=>
One simple workaround to allow automation – (A 3 step job):
1. Create a file _header.txt that has the column headings
i.e. copy the first row [with header] of a select * from table, paste into excell, keep only headings and save as .txt
2. bcp out to Data.txt file
i.e. bcp DB.dbo.table_name out c:\table_nameData.txt -Sserver -T -c
3. Concatenate files with the copy command
i.e. copy /a /Y C:\tbl_header.txt + C:\tbl_Data.txt C:\tbl.txt
Also, you can bcp out of a view which offers tremendous additional functionality… :-)<=-=May 28 2014 3:54AM=-=>
This problem is still open.
Many People use diverent workaround.
I allthoug missing for BCP a text seperatr for Quots like.
thx Olaf<=-=Oct 5 2017 1:38PM=-=>
Any updates on this feature? this can make a huge difference when exporting huge sql tables!!