trompetaloco
MIS
I have a DTS task that uses an Active X controller step to determine if the entire routine should be executed based on the existence of records to be processed. If there are no records to be processed, the controller step sets all subsequent steps to completed and sets ExecResult to successful. All appears to work fine. However, when the task is scheduled in SQL Agent the agent reports a failure if there are no records to process. It appears that if the task completes normally the exit code is 0. However, if the controller finds no records to process and bypasses the remaining steps, the exit code is 3. SQL Agent only accepts one value for a successfull exit code, so I can't tell it to expect either a 0 or 3.
Does anyone know why this is the case and how to force the exit code?
Here is the code for the Active X controller step:
If DTSGlobalVariables("DirtyCount"
.Value = 0 Then
Set oPKG = DTSGlobalVariables.Parent
oPKG.Steps(1).ExecutionStatus = DTSStepExecStat_Completed
oPKG.Steps(2).ExecutionStatus = DTSStepExecStat_Completed
oPKG.Steps(3).ExecutionStatus = DTSStepExecStat_Completed
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Success
End If
Does anyone know why this is the case and how to force the exit code?
Here is the code for the Active X controller step:
If DTSGlobalVariables("DirtyCount"
Set oPKG = DTSGlobalVariables.Parent
oPKG.Steps(1).ExecutionStatus = DTSStepExecStat_Completed
oPKG.Steps(2).ExecutionStatus = DTSStepExecStat_Completed
oPKG.Steps(3).ExecutionStatus = DTSStepExecStat_Completed
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Success
End If