Precedence Constraints

Precedence constraints link executables, containers, and tasks in packages into a control flow, and specify conditions that determine whether executables run. An executable can be a For Loop, Foreach Loop, or Sequence container; a task; or an event handler. Event handlers also use precedence constraints to link their executables into a control flow.

A precedence constraint links two executables: the precedence executable and the constrained executable. The precedence executable runs before the constrained executable, and the execution result of the precedence executable may determine whether the constrained executable runs. The following diagram shows two executables linked by a precedence constraint.

The nested-container architecture of Integration Services enables all containers, except for the task host container that encapsulates only a single task, to include other containers, each with its own control flow. The For Loop, Foreach Loop, and Sequence containers can include multiple tasks and other containers, which in turn can include multiple tasks and containers. For example, a package with a Script task and a Sequence container has a precedence constraint that links the Script task and the Sequence container. The Sequence container includes three Script tasks, and its precedence constraints link the three Script tasks into a control flow. The following diagram shows the precedence constraints in a package with two levels of nesting.

Because the package is at the top of the SSIS container hierarchy, multiple packages cannot be linked by precedence constraints; however, you can add an Execute Package task to a package and indirectly link another package into the control flow.

You can configure precedence constraints in the following ways:

Specify an evaluation operation. The precedence constraint uses a constraint value, an expression, both, or either to determine whether the constrained executable runs.

If the precedence constraint uses an execution result, you can specify the execution result to be success, failure, or completion.

If the precedence constraint uses an evaluation result, you can provide an expression that evaluates to a Boolean.

Specify whether the precedence constraint is evaluated singly or together with other constraints that apply to the constrained executable.

A constraint that uses only the execution result of the precedence executable to determine whether the constrained executable runs. The execution result of the precedence executable can be completion, success, or failure.

An expression that is evaluated to determine whether the constrained executable runs. If the expression evaluates to true, the constrained executable runs.

An expression and a constraint that combines the requirements of execution results of the precedence executable and the return results of evaluating the expression.

An expression or a constraint that uses either the execution results of the precedence executable or the return results of evaluating the expression.

The precedence constraint can use the following execution results alone or in combination with an expression.

Completion requires only that the precedence executable has completed, without regard to outcome, in order for the constrained executable to run.

Success requires that the precedence executable must complete successfully for the constrained executable to run.

Failure requires that the precedence executable fail for the constrained executable to run.

Note:

Only precedence constraints that are members of the same Precedence Constraint collection can be grouped in a logical AND condition. For example, you cannot combine precedence constraints from two Foreach Loop containers.