Using DTSStepScriptResult_DontExecuteTask to skip a single step -
04-05-2005
, 09:25 PM
Hello All,
I have a situation where DTS will need to anticipate an occurance where a
file is not present. I do that just fine but I don't want to skip all the
rest of teh steps in the package. I likely have either other files to load
in or archiving that needs to execute in that package.
The script below was changed from the SQLDTS.com article 211
I thought that if I simply called
"pkg.Steps("DTSStep_DTSActiveScriptTask_5").Execut ionStatus =
DTSStepExecStat_Waiting ", that step would execute and I could skip ove the
step I want to by using "Main = DTSStepScriptResult_DontExecuteTask"
Any help is greatly appreciated.
Function Main()
Dim pkg, oFSO, sFileName
'STOP
set pkg = DTSGlobalVariables.Parent
' Get the name of the file from the global variable "FullPath"
sFileName = DTSGlobalVariables("FullPath").Value
msgbox(sFileName)
Set oFSO = CreateObject("Scripting.FileSystemObject")
' Check for file and return appropriate result
If not oFSO.FileExists(sFileName) Then
'set file = oFSO.GetFile(sFileName)
'If file.Size = 0 Then
msgbox "Missing File " '& sFileName.size & " bytes"
pkg.Steps("DTSStep_DTSActiveScriptTask_5").Executi onStatus =
DTSStepExecStat_Waiting
msgbox"I executed move to history"
pkg.Steps("DTSStep_DTSCreateProcessTask_1").Execut ionStatus =
DTSStepExecStat_Waiting
msgbox"I executed Zipit"
Main = DTSStepScriptResult_DontExecuteTask
ELSE
msgbox "File size is " '& sFileName.size & " bytes"
Main = DTSStepScriptResult_ExecuteTask
End if
Set oFSO = Nothing
End Function |