I tend to use bcp too. Just dump everything into a temp table and bcp out of it. However if you want to use DTS here's an example to give you an idea.Create a package with a SQL connection a Text (Destination) connection and a Transform specifying the data to export. THen create an ActiveX Script Task than runs after the transform completes (use the On Success Workflow). In the ActiveX Script paste the following. This example uses hard code values but you could use Global Variables, a table lookup, an ini file etc. To get your row count you could use an execute SQL task instead and put the rowcount in a global variable accessible by the script.Function Main() Dim fso,WshShell,h,hline,t,tline,hpath,tpath,shCmd,final Dim dConn,dfile,rcount '************************************ ' Get Destination Text file Name '************************************ Set dConn = DTSGlobalVariables.Parent.Connections("Text File (Destination)") dfile = dConn.DataSource '************************************ ' Get Rowcount (for example) '************************************ rcount = DTSGlobalVariables("count").value '**************************************************************** ' These are hard coded but could easily be gotten from ' Global Variables,table lookups,ini file etc ' THe header and trailer rows could be from a SQL query '******************************************************************* hline = "HDR" + CStr(FormatDateTime(Date, 2)) + "001" tline = "TRAILER+++++++++" & rcount hpath = "c:\header.txt" tpath = "c:\trailer.txt" final = "c:\dts.txt" '******************************* ' This cmd merges the files '******************************* shCmd = "%comspec% /c copy /B/Y " & hpath &_ "+" & dfile & "+" & tpath & " " & final Set fso = CreateObject("Scripting.FileSystemObject") set WshShell = CreateObject("WScript.Shell") '******************************* ' Write the header record '******************************* Set f = fso.OpenTextFile(hpath, 2, True) f.WriteLine hline f.Close '******************************* ' Write the trailer record '******************************* Set t = fso.OpenTextFile(tpath, 2, True) t.WriteLine tline t.Close '******************************* ' Merge the files '******************************* WshShell.run shCmd,0,True Set fso = Nothing Set WshShell = Nothing Main = DTSTaskExecResult_SuccessEnd FunctionHTHJasper SmithEdited by - jasper_smith on 08/23/2002 19:19:46