How to run a step using ActiveX script
Hi All,
(SQL Server 2000 SP4 on Windows 2003)
I have a DTS package that loads data from a text file to a table. The first validation is to check if the correct file is in the relevant folder so that the same file is not loaded multiple times. If the file does not exist I stop the DTS using an ActiveX script
within the workflow of the Bulk Load task.
What I would now like to do is to instead of stopping the DTS completely to run another step in the same package (without using On Failure). So I need to know how to call/execute a step in the above ActiveX script. So the logic would be something like:
[check file exists] ----> NO ---->
[execute ActiveX script within Bulk Load workflow to stop execute of step] -----> [use same ActiveX script to execute another step].
I have absolutely no ActiveX/VB Script experience. All the code I have used has been cobbled together from various websites. As I understand I need to use the DTS Object Model (here
) but I just don't know how to do that!
The script I've written does not work:
Option Explicit
Function Main()
Dim oFSO, sFileName, oPkg, oActiveX
' Get the name of the file from the global variable "NextITOLFileName"
sFilename = DTSGlobalVariables("NextITOLFileName").Value
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oPkg = DTSGlobalVariables.Parent
Set oActiveX = oPkg.Task.ActiveScriptTask("DTSTask_DTSActiveScriptTask_1")
' Check for file and return appropriate result
If oFSO.FileExists(sFilename) Then
' run the bulk load task
Main = DTSStepScriptResult_ExecuteTask
Else
' file missing, so run a different task
' THIS IS THE BIT THAT DOES NOT WORK
oActiveX.Execute
End If
Set oFSO = Nothing
Set oActiveX = Nothing
Set oPkg = Nothing
End Function
Please help!
November 9th, 2010 9:35am
Perhaps this will help in your understanding SQL 2000 workflow:
http://www.sqldts.com/214.aspxChaos, Disorder and Panic ... my work is done here!
Free Windows Admin Tool Kit Click here and download it now
November 9th, 2010 1:03pm
Hi,
Thanks very much for your reply. That is exactly what I need to do. I searched that site several times - but clearly didn't use the right keywords! I think I will need to find a good book on DTS because the BOL entries are not that informative. Thanks again
for your help.
November 10th, 2010 4:17am