bcp question - Column Names?

  • Hello,

    MSSQL 7/2000

    Using the bcp utility, is there a way to save the column names as row#1? I can't find any docs or examples with this?

     

    Many thanks. Jeff

  • No, that is not a function of bcp....

     

  • Jeff,

    If you are talking about importing with BCP, you can tell it to skip the first row by setting the first row (-F) parameter to 2.

    If you are talking about exporting with BCP to save the first row with the column names, then Scorpion 66 is correct... can't be done with BCP.

    It can, however, be done using OSQL, a SELECT query, and the (-o) output file parameter.  And, if you need it in CSV format, just specify the (-s) parameter... here's what that does according to BOL...

    -s col_separator

    Specifies the column-separator character, which is a blank space by default. To use characters that have special meaning to the operating system (for example, | ; & < > ), enclose the character in double quotation marks (").

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply