dbTalk Databases Forums  

Re: Append to text

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


Discuss Re: Append to text in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Append to text - 12-11-2003 , 06:21 PM






What exactly are you trying to do?
Is this the ActiveX Script Task or an Active Script transform?


dim fso
dim fil

set fso = CREATEOBJECT("Scripting.FileSystemObject")

If fso.FileExists("c:\MyFile.txt") THEN
set fil = fso.OpenTextFile("c:\MyFile.txt",8)
fil.Writeline "Line Added after appending"
ELSE
set fil = fso.CreateTextFile("c:\MyFile.txt")
fil.Writeline "Line Added When Created"

END IF

fil.Close
set fil = NOTHING
set fso = NOTHING




--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"textfile" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
If have the below code in active x vb. If the file is already created I
want to APPEND to the file.

if fso.FileExists(sFolder & "TransferText " & todayDate &" .log") then
set logfile = fso.OpenTextFile(sFolder & "\History\TransferText " &
todayDate &" .log", 3, false)
else
set logfile = fso.CreateTextFile(sFolder & "\History\TransferText " &
todayDate &" .log", true)
end if

I know it is easy, I just can't fine the answer.



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.