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)
 Setting DTS global variable using ActiveX

Author  Topic 

rocksteer
Yak Posting Veteran

69 Posts

Posted - 2008-09-19 : 13:38:05
I keep getting a type mismatch error when trying to set a DTS Global variable using an ActiveX Script.

I first created/initialized a global variable (pkg properties, Global Variables) named gReportDate and typed it date, and when that did not work tried typing it string.

I tried to set it using the following ActiveX Script...

Function Main()
dim ReportDate
dim WeekDayNum

ReportDate = date()

WeekDayNum = weekday(Now() )


if WeekDayNum = 6 then
ReportDate = dateadd("d",-1,ReportDate)
else
ReportDate = dateadd("d",-3,ReportDate)
end if

msgbox(ReportDate)

DTSGlobalVarables("gReportDate"),value = ReportDate

Main = DTSTaskExecResult_Success
End Function

The script parsed and gave the correct value in the message box, but when I tried to set the global variable, it gave a type mismatch error.

Why? (I would like to use the calculated ReportDate in the where clause of my SQL query.)
   

- Advertisement -