Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Variable in DTS Package

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

Is it possible to insert value of a global variable into a Execute SQL Task in DTS Package Design? If so, how?

Thanks alot in advance.
 
I am not a scripting wizard but the scriptbelow creates a global variable (filename) that we use to create a unique file for export on a daily basis.
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()
Dim oConn, sFilename, ffilename
' Filename format - exyymmdd.log
sFilename = "\\Dms4\phar\"
ffilename = Year(Now())
If Month(Now()) < 10 Then fFilename = fFilename & &quot;0&quot; & _
Month(Now()) Else fFilename = fFilename & Month(Now())
If Day(Now()) < 10 Then fFilename = fFilename & _
&quot;0&quot; & Day(Now()) Else fFilename = fFilename & Day(Now())
fFilename = fFilename & hour(Now()) & minute(now())
fFilename = DTSGlobalVariables(&quot;LogFilePath&quot;).Value & _
fFilename & &quot;.log&quot;
sFilename = sfilename & ffilename
Set oConn = DTSGlobalVariables.Parent.Connections(&quot;Text File (Destination)&quot;)
oConn.DataSource = sFilename
' oConn.DataTarget = sFilename
Set oConn = Nothing
DTSGlobalVariables( &quot;fname&quot;).Value = ffilename
Main = DTSTaskExecResult_Success
End Function
 
thank you for your reply. But what I intended to ask is that how to insert the value of a global variable into a &quot;Execute SQL Task&quot; of a DTS package.

Thanks alot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top