Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Object doesn't support DTSGlobalVariables

Author  Topic 

net4hire
Starting Member

6 Posts

Posted - 2004-09-02 : 13:46:23
I'm new to DTS on SQL Server 7. I got this error when executing an active x script using DTSGlobalVariables. Is there a step that I needed to have done before using global variables in the script? Appreciate your help.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-09-02 : 14:21:18
http://www.sqldts.com/default.aspx?205

Tara
Go to Top of Page

net4hire
Starting Member

6 Posts

Posted - 2004-09-02 : 17:39:24
Tara - Thank so much for your response. I added the code (in red) to include reference to the DTSGlobalVarialbe.Parent from the example you sent but the error still remains.

Function Main()
Dim oPkg, oDataPump, sSQLStatement

' Build new SQL Statement
sSQLStatement = "SELECT * FROM dbo.employee WHERE hire_date > '" & _
DTSGlobalVariables("HireDate").Value & "'"

' Get reference to the DataPump Task
Set oPkg = DTSGlobalVariables.Parent
Set oDataPump = oPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask

' Assign SQL Statement to Source of DataPump
oDataPump.SourceSQLStatement = sSQLStatement[/b]


'Original code
DTSGlobalVariables("PostDate") = month(now()) & "/" & day (now()) & "/" & year(now())
dim tmp
dim filename

tmp = right("0" & datepart("m", DTSGlobalVariables("PostDate")), 2)
tmp = tmp & right("0" & datepart("d", DTSGlobalVariables("PostDate")), 2)
tmp = tmp & datepart("yyyy", DTSGlobalVariables("PostDate"))
DTSGlobalVariables("Datestamp") = tmp
filename = DTSGlobalVariables("TransferFileNameRoot") & DTSGlobalVariables("Datestamp")
DTSGlobalVariables("TransferFilename") = DTSGlobalVariables("TransferFileDir") & "\" & DTSGlobalVariables("TransferFileNameRoot") & DTSGlobalVariables("Datestamp")


' Clean Up
Set oDataPump = Nothing
Set oPkg = Nothing
Main = DTSTaskExecResult_Success
End Function

Ruben
Go to Top of Page
   

- Advertisement -