dbTalk Databases Forums  

Appending to an existing text file destination

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Appending to an existing text file destination in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
karenmiddleol@yahoo.com
 
Posts: n/a

Default Appending to an existing text file destination - 05-31-2005 , 10:24 PM






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


Reply With Quote
  #2  
Old   
Ed
 
Posts: n/a

Default RE: Appending to an existing text file destination - 05-31-2005 , 10:49 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


"karenmiddleol (AT) yahoo (DOT) com" wrote:

Quote:
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



Reply With Quote
  #3  
Old   
Darren Green
 
Posts: n/a

Default Re: Appending to an existing text file destination - 06-01-2005 , 02:54 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
<karenmiddleol (AT) yahoo (DOT) com> wrote

Quote:
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




Reply With Quote
  #4  
Old   
Helge C. Rutz
 
Posts: n/a

Default Re: Appending to an existing text file destination - 06-01-2005 , 03:09 AM



Hi Karen,

"Darren Green" wrote:
Quote:
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.
yes, as simple, and you need only two files so that you append as you
wanted
Quote:
copy file.txt+other.txt newfile.txt
copy all.txt + out.txt all.txt

Helge



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.