Search code examples
ssisssis-2012

What does it mean by Precedence Constraint evaluate to True (or False) in SSIS


I am learning SSIS, and while trying to understand Precedence Constraint configuration (in MS SQL SERVER web portal), there is a scenario where we could use Precedence Constraint Evaluation value (true or false) OR Expression value.

What does it mean by Precedence Constraint Evaluation with one of the possible (condition) values: Success /Failure /Completion evaluates to true (or false)?

To my understanding, if I set the Precedence Constraint Evaluation value: Failure, the precedence constraint evaluation results to true if it the precedence task is a failure and vice versa (for the value: Success or Completion). Am I right?

Can anyone please help me understand. Attached the screenshot taken from the MS SQL Server web portal: enter image description here.


Solution

  • Precedence constraints link executables, containers, and tasks in packages in 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. Let's consider having in one package, two tasks like below :

    enter image description here

    Your business logic requires executing the tasks according to these 2 conditions :

    1. Start package execution with task 1
    2. If the task 1 fails, then execute task 2

    Note if you don't have these 2 coditions, the two tasks can be executed in parallel.

    enter image description here

    In general, you can use SSIS precedence constraints to define a program flow from one task to another. You will have a green color arrow which defines precedence constraints. By right-clicking on the arrow, you can change precedence constraint from success to failure or completion. enter image description here

    Let's have this scenario, the package executes in the following manner:

    enter image description here

    1. Start package execution withtask 1
    2. If the task 1 fails, then only execute task 2

    If the task 1 fails which means the constraint evaluates to true, the tast 2 will be executed.

    enter image description here

    If the task 1 succeds which means the constraint evaluates to false, the tast 2 will not be executed.

    enter image description here