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. |