all groups > sql server dts > may 2005 >
You're in the

sql server dts

group:

Appending to an existing text file destination


Appending to an existing text file destination karenmiddleol NO[at]SPAM yahoo.com
5/31/2005 8:24:14 PM
sql server dts:
I want to keep appending to an existing text file destination output
file everytime I run a DTS Package.

Unfortunately DTS keeps ovwerwriting what is in the file.

How do I append into a text file destination.

Thanks
Karen
RE: Appending to an existing text file destination Ed
5/31/2005 8:49:38 PM
Karen,
Would you like to try to use Excel Spreadsheet and save it as text file by
using ActiveXScript after the export?

Function Main()
' Launch Excel
Dim Xl
Dim sSourceFile
Dim sOutputFile


sSourceFile = DTSGlobalVariables("gSourceFile").Value
sOutputFile = DTSGlobalVariables("gOutputFile").Value
'MsgBox sSourceFile
'MsgBox sOutputFile

Set Xl = CreateObject("Excel.Application")

'Make it in-visible
Xl.Visible = False

'Open my execl file, and sheet
Xl.Workbooks.Open(sSourceFile)
Xl.Worksheets("YourWorkSheetName").Select

Xl.ActiveWorkbook.SaveAs sOutputFile,-4158,0
Xl.ActiveWorkbook.Close(0)
Xl.quit

Main = DTSTaskExecResult_Success
End Function

Hope this help
Ed


[quoted text, click to view]
Re: Appending to an existing text file destination Darren Green
6/1/2005 12:00:00 AM
The text file destination doesn't support appending to files. Write a new
file then merge them together. Simple way is to use DOS copy, e.g.

copy file.txt+other.txt newfile.txt


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com
[quoted text, click to view]

Re: Appending to an existing text file destination Helge C. Rutz
6/1/2005 12:00:00 AM
Hi Karen,

[quoted text, click to view]
yes, as simple, and you need only two files so that you append as you
wanted
[quoted text, click to view]
copy all.txt + out.txt all.txt

Helge
AddThis Social Bookmark Button