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.
Integration Services provides the following evaluation operations:
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 expression must be a valid SSIS expression, and it can include functions, operators, and system and custom variables. For more information, see Integration Services Expression Reference and Integration Services Variables.
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.
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.
Configuring the Precedence Constraint
You can set properties through SSIS Designer or programmatically.
For more information about the properties that you can set in SSIS Designer, click the following topic:
For more information about how to set these properties in SSIS Designer, click one of the following topics:
Configuring the Precedence Constraint Programmatically
For more information about programmatically setting these properties, click the following topic: