The mainCodeTo set a global variable dtsglobalvariables ("Sourcefilename")
' **************************************** ******************************
' Visual Basic ActiveX script
' **************************************** ********************************
Option Explicit
Function Main ()
Createfile
Main = Dtstaskexecresult_success
End Function
Sub Createfile ()
Dim Todaydate, stringt
Dim Mymonth, myday
If Month ( Date ) < 10 Then
Mymonth = " 0 " & Month ( Date )
Else
Mymonth = Month ( Date )
End If
If Day ( Date ) < 10 Then
Myday = " 0 " & Day ( Date )
Else
Myday = Day ( Date )
End If
Stringt = " ABC " & Year ( Date ) & Mymonth & Myday & " . Txt "
Dtsglobalvariables ( " Sourcefilename " ). Value = CHR (39) & stringt & CHR (39) & CHR (59) & CHR (39) & CHR (39) & CHR (59) & CHR (39) & CHR (39) & CHR (59)
Msgbox Dtsglobalvariables ( " Sourcefilename " ). Value
End sub
The final result of sourcefilename is similar to this:
'File3. dat '; ''; '123 ';
According to the SQL online manual, the content between the three ''is
File Name, directory, and file size;
Object.Sourcefilename[='Name';'Path';'Size';'Name';'Path';'Size';...]