How do I append to a DTS .csv file | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How do I append to a DTS .csv file

Hi I have multiple Transform Data Tasks in my package, each running some SQL and writing to a .csv output file. I’d like the first of these tasks to create (and write to) a new file, and the subsequent steps to append to the newly created file … thoughts? Thanks
Cant you use the code like this? If Exists(File)
–Append data
—Create file and write data See if you find any such scripts here Madhivanan Failing to plan is Planning to fail
Thanks for your reply. I’ve searched high and low and did not find anything. I’m not using the standard ‘Destination file’ and ‘Data Transformation’ steps in DTS so do not have any programming in it – and cannot see how I can use your suggested if/else. What I did in the end was to create a temporary table on my database, write all my output to the temp table (append), and then as a last step have a ‘Data Transformation’ step that creates one destination file from the temporary table so this is no longer an issue. Rgds
You can also create separate output files and then use dos (command prompt)
copy output1.csv … outputN.csv finalOutput.csv
If you want it automaticaly you can schedule a job with two stpes: first running dts package and final step running if first one haven’t failed with copy command mentioned. You can also add an delete command to delete output1-outputN.csv.
Thanks Rgds