tb
Programmer
- May 27, 2003
- 328
Hi all,
I need to execute only certain steps/tasks within my DTS package from VB.
To be precise ...
**ActiveX Script
**Transform Data Task (1)
**Transform Data Task (2)
There may be several Transform Data Task, but only 2 that will be applicable.
(I think) I know what I need to do ...its just the "HOW" ...
Can anyone who has done this before give me a few pointers?
The below is what I have but you'll see where I got stuck ...
Dim objPackage As DTS.Package2
Dim objSQL As DTS.ActiveScriptTask
Dim objTask As DTS.Task
Dim objCustTask As DTS.ExecutePackageTask
'Instanciate the DTS package object
Set objPackage = New DTS.Package2
'Set the server/username/password and the DTS package to be run
objPackage.LoadFromSQLServer "ServerIP", "UserName", "Password", DTSSQLStgFlag_Default, "", "", "", "DTS_Package_Name"
'Set Global variables
objPackage.GlobalVariables("Value1").Value = True
objPackage.GlobalVariables("Value2").Value = mpValue2
objPackage.GlobalVariables("Value3").Value = mpValue3
objPackage.GlobalVariables("Value4").Value = mpValue4
'Set object to raise an error on failure and to do eventlogs
objPackage.FailOnError = True
objPackage.WriteCompletionStatusToNTEventLog = True
*** Normally I would just execute the package ***
'objPackage.Execute
'objPackage.UnInitialize
**** Now it get interesting ****
**Alternative 1
Set objTask = objPackage.Tasks.Item("zz") -- How will I get the value of what will replace "zz" ?
Set objCustTask = objTask.CustomTask
objCustTask.Execute
**Alternative 2
objPackage.Tasks.Item("zz").Execute
Any advise will be much appreciated.
Hope the explanation was sufficient ..
I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
I need to execute only certain steps/tasks within my DTS package from VB.
To be precise ...
**ActiveX Script
**Transform Data Task (1)
**Transform Data Task (2)
There may be several Transform Data Task, but only 2 that will be applicable.
(I think) I know what I need to do ...its just the "HOW" ...
Can anyone who has done this before give me a few pointers?
The below is what I have but you'll see where I got stuck ...
Dim objPackage As DTS.Package2
Dim objSQL As DTS.ActiveScriptTask
Dim objTask As DTS.Task
Dim objCustTask As DTS.ExecutePackageTask
'Instanciate the DTS package object
Set objPackage = New DTS.Package2
'Set the server/username/password and the DTS package to be run
objPackage.LoadFromSQLServer "ServerIP", "UserName", "Password", DTSSQLStgFlag_Default, "", "", "", "DTS_Package_Name"
'Set Global variables
objPackage.GlobalVariables("Value1").Value = True
objPackage.GlobalVariables("Value2").Value = mpValue2
objPackage.GlobalVariables("Value3").Value = mpValue3
objPackage.GlobalVariables("Value4").Value = mpValue4
'Set object to raise an error on failure and to do eventlogs
objPackage.FailOnError = True
objPackage.WriteCompletionStatusToNTEventLog = True
*** Normally I would just execute the package ***
'objPackage.Execute
'objPackage.UnInitialize
**** Now it get interesting ****
**Alternative 1
Set objTask = objPackage.Tasks.Item("zz") -- How will I get the value of what will replace "zz" ?
Set objCustTask = objTask.CustomTask
objCustTask.Execute
**Alternative 2
objPackage.Tasks.Item("zz").Execute
Any advise will be much appreciated.
Hope the explanation was sufficient ..
I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!