BCP output with header and trailer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sbh

    #1

    BCP output with header and trailer

    I'm copying data out to a file with pipe delimiters. I would like to
    add a header and trailer.

    Is this possible? If so, please help me with the steps.

    Also, is it possible to append to a text file while doing the bcp? If
    so, how?
  • Simon Hayes

    #2
    Re: BCP output with header and trailer


    "sbh" <stephanie.herb ert@tdh.state.t x.us> wrote in message
    news:1d68006.04 03040850.23a28c cb@posting.goog le.com...[color=blue]
    > I'm copying data out to a file with pipe delimiters. I would like to
    > add a header and trailer.
    >
    > Is this possible? If so, please help me with the steps.
    >
    > Also, is it possible to append to a text file while doing the bcp? If
    > so, how?[/color]

    Not directly, but you might be able to use -queryout or osql.exe -o to
    execute a query or stored procedure which returns your header and trailer
    information as well as the data. Since you don't say what you want in your
    header/trailer, it's hard to be more precise. As for appending, I believe
    that both bcp and osql overwrite any existing file, but a simple script in
    Perl, VBScript etc. would be a more flexible solution.

    Simon


    Comment

    Working...