Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

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

2 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    AdminMicrosoft SQL Server (Admin, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    unplanned  ·  AdminMicrosoft SQL Server (Admin, Microsoft Azure) responded  · 

    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_name
    Data.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=-=>

    Hello

    This problem is still open.
    Many People use diverent workaround.

    I allthoug missing for BCP a text seperatr for Quots like.
    “text1”,“text2”,“text3”

    thx Olaf

    <=-=Oct 5 2017 1:38PM=-=>

    Any updates on this feature? this can make a huge difference when exporting huge sql tables!!

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base