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

DTS Job and Exit Code

Status
Not open for further replies.
Jan 1, 2002
7
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top