I have a DTS that connects to a SQL db and then executes a stored procedure and saves the output into a flat file. This DTS runs daily and thus overwrites the file each day. My goal is to have the datetime be a part of the filename going forward. I have seen all kinds of TK's out there about creating an ActiveX Script Task or a Dynamic Properties Task. Before I started adding in all of this the DTS is fine.
I now have both the Active X and the Dynamic Properties Task created and running prior to the Exec of the sp or the Transform Data Task.
Here is the script on the Active X
Option Explicit
Function Main()
Dim oConn, sFilename
' Filename format - List_t00024458mai_20080519.txt
sFilename = "List_t00024458mai_" & Month(Now) & Day(Now) & Year(Now) & Hour(Time) & Minute(Time) & Second(Time) & ".txt"
DTSGlobalVariables("fileName").Value = "E:\GPShare\Integrations\Concur\" & sFilename
Set oConn = DTSGlobalVariables.Parent.Connections("Text File [Destination]")
oConn.DataSource = DTSGlobalVariables("fileName")
Set oConn = Nothing
Main = DTSTaskExecResult_Success
End Function
The scritp bombs out on the "Text File [Destination]" saying that the DTS Connection was not found. This is when I execut the DTS or just the Active X.
The Dynamic Properties Task is:
Destination Property: Value
Source Type: Global Variable
Source Value: fileName
The default value of the fileName is: E:\GPShare\Integrations\Concur\List_t00024458mai_5192008221725.txt
I am at a loss and only have experience DTS once, not repeatedly with different file names. Have never had to use activex or anything. Please help! I am on a deadline and am freaking out.
I now have both the Active X and the Dynamic Properties Task created and running prior to the Exec of the sp or the Transform Data Task.
Here is the script on the Active X
Option Explicit
Function Main()
Dim oConn, sFilename
' Filename format - List_t00024458mai_20080519.txt
sFilename = "List_t00024458mai_" & Month(Now) & Day(Now) & Year(Now) & Hour(Time) & Minute(Time) & Second(Time) & ".txt"
DTSGlobalVariables("fileName").Value = "E:\GPShare\Integrations\Concur\" & sFilename
Set oConn = DTSGlobalVariables.Parent.Connections("Text File [Destination]")
oConn.DataSource = DTSGlobalVariables("fileName")
Set oConn = Nothing
Main = DTSTaskExecResult_Success
End Function
The scritp bombs out on the "Text File [Destination]" saying that the DTS Connection was not found. This is when I execut the DTS or just the Active X.
The Dynamic Properties Task is:
Destination Property: Value
Source Type: Global Variable
Source Value: fileName
The default value of the fileName is: E:\GPShare\Integrations\Concur\List_t00024458mai_5192008221725.txt
I am at a loss and only have experience DTS once, not repeatedly with different file names. Have never had to use activex or anything. Please help! I am on a deadline and am freaking out.