Question : How to append to an existing output file using BCP utility?


I use BCP to dump data from a table to a text file.  Everytime it's executed, the text file gets overwritten.  Is it possible to append to the existing text file instead of overwriting?  Thanks.  

Answer : How to append to an existing output file using BCP utility?

Since bcp is a command-line utility, you can use the command prompt functionality to achieve what you are looking to do.  To do this:

1) BCP to a temp file
2) Append the output.  Ways to do this at the command line:

COPY [PermanentFileName]+[TempFileName] [TempFile2]
KILL [PermanentFileName]
REN [TempFile2] [PermanentFileName]

-- Or --

TYPE [TempFileName] >> [PermanentFileName]
Random Solutions  
 
programming4us programming4us