The OnFailAction property controls the behavior of a SQL Server Agent job when the referenced step fails execution.
object.OnFailAction [= value]
object
Expression that evaluates to an object in the Applies To list
value
Long integer that specifies job logic as described in Settings
Long, enumerated.
Read/write
HRESULT GetOnFailAction(SQLDMO_JOBSTEPACTION_TYPE* pRetVal);
HRESULT SetOnFailAction(SQLDMO_JOBSTEPACTION_TYPE NewValue);
Constant | Value | Description |
---|---|---|
SQLDMOJobStepAction_GotoStep | 4 | Continue execution at the next identified step. |
SQLDMOJobStepAction_GotoNextStep | 3 | Continue execution at the next sequential step. |
SQLDMOJobStepAction_QuitWithFailure | 2 | Terminate job execution, reporting failure. |
SQLDMOJobStepAction_QuitWithSuccess | 1 | Terminate job execution, reporting success. |
SQLDMOJobStepAction_Unknown | 0 | Job step logic is unassigned for the referenced job step. |
On failure of a job step, SQL Server Agent can terminate the job (reporting success or failure) or, if the job has more than a single step, can attempt to execute the next step or another step in the job.
When using SQLDMOJobStepAction_GotoStep to direct execution to a specific step, set the OnFailStep property to identify the job step executed on failure.