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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to DTS

Status
Not open for further replies.

gmctrek

Programmer
Jul 8, 2004
10
US
Sybase does not allow parameterized SQL statements. Therefore, I must build my SQL statement using Global variables. I'm new to DTS and I found the link below. What do you do with this ActiveX Script Task after it is built? I understand the code until you get to: "Get reference to the DataPump Task." Should I build a Data Transformation Task and call it "DTSTask_DTSDataPumpTask_1".




' 205 (Change SourceSQLStatement)
Option Explicit

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

' Clean Up
Set oDataPump = Nothing
Set oPkg = Nothing

Main = DTSTaskExecResult_Success
End Function




Thanks,

gmctrek
 
gmctrek,

In case you have not yet been answered on this one.

You will need to assign the "HireDate" Global Variable using the Dynamic Properties Task before you run this ActiveX code.

The "DTSTask_DTSDataPumpTask_1" Task is created as a CustomTask when you "Set oDataPump = ...".


HTH,
DataLWalker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top