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 2005 Forums
 Transact-SQL (2005)
 BCP export with column headers

Author  Topic 

zstone
Starting Member

6 Posts

Posted - 2007-08-02 : 19:39:27
Hi All,

I am using BCP to export some data from the database into a CSV file.

I am trying to include the column headers ( filed names ) in the exported file but the file keeps getting generated without the column names / headers.

Is this possible in BCP ?

Thanks

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-02 : 22:35:21
May try run two select statements in bcp. First one looks like 'select 'col1', 'col2', ... from ...' and save result to output file. Second one dumps data and appends results to same output file.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-03 : 02:53:21

http://weblogs.sqlteam.com/brettk/archive/2005/04/13/4395.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -