How can I call BCP (bulk copy SQl Server) with Header columns in C# to export data from sql server to a text file.
Can you show me some examples?
Call BCP in C# with header columns
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Feb 15, 2014, 12:42 PM EST
http://social.msdn.microsoft.com/Forums/en-US/cfb40e41-d6c9-4b0c-a1de-c10230588fcc/bcp-utility-using-c-?forum=adodotnetdataproviders
Unfortunately, the BCP utility doesn't have a straightforward option to include column headers with the data. However, I found another link where someone's had the bright idea of using the 'queryout' option and then using UNION ALL to link a list of column headers with the rows of the datatable:
http://stackoverflow.com/questions/1355876/export-table-to-file-with-column-headers-column-names-using-the-bcp-utility-an
Hopefully, you'll be able to figure something out from this.
j c45 reputationPosted Feb 17, 2014, 4:57 AM EST