Thursday, January 22, 2009

Precedence Constraints

SSIS provides an updated version of the Precedence Constraints we had in DTS. They are the connectors between any two tasks in a flow. They decide the direction of the flow .

1.These Precedence Constraints can be configured in multiple ways.
2. A task can have multiple connectors indicating the multiple tasks that can be concurrently executed following its own completion.





3. If you wish to add a Precedence constraint, click on one task. It gives out an green arrow i.e. the precedence constraint. Drag the arrow to the next task you wish to connect to. You have now established the precedence between the two tasks. The second task will get executed on success of the first task.

4. The green arrow indicates "On Success". If you wish to add a task that should get executed on failure of a task, just right click on the green Precedence constraint and select Failure. The second task will now get executed on failure of the first task.

5. If you wish to add a task that should get executed on completion of first task, just right click on the green Precedence constraint and select Completion. The second task will now get executed on completion of the first task.

6. You can even add conditions to Precedence Constraint on which the next task will get executed.

7. Double click the Constraint, it shows you the Precedence constraint Editor.



8. You can configure multiple conditions on which your next task will get executed.

9. Evaluation operation allows you to select on which parameters you wish to configure the constraint.

If you select "Constraint", You need to select an value in the Value dropdown. Flow will move to next task based only on this value.

e.g. you select "Success" in Value dropdown, then only if the first task succeeds, the second task will get executed. If you select "Failure", then only if the first task fails, the second task will get executed.

If you select "Expression and Constraint", You need to select an value in the Value dropdown and specify a constraint in Constraint box. Flow will move to next task based on Value dropdown and successful evaluation on the Constraint.
e.g. in the image shown, the next task will get executed only if first task succeeds AND the variable "Count" is greater than zero.

10. The way a task can have multiple precedence constraints going out of it, it can even have multiple precedence constraints coming to it.

e.g. A certain task can be a joining point of two alternative path flows. So only one of its preceding task will get executed at any time and not both.


11. If however they are not alternative paths, the task may require both the previous path flows to finish before it starts execution.

12. This can be configured using the two radio buttons provided at the bottom of the Precedence Constraint Editor.

Logical AND : Indicates both the incoming tasks have to executed before this task can be executed.

Logical OR: Indicates completion of either of the incoming tasks is sufficient for the next task to executed.





e.g. In the above image, the Send Mail task will work if either of "Move File" Or "Delete File" task completes successfully.






1 comment:

  1. I think there is a need to provide some more information about SSIS and even other complex IT problems.

    SSIS Postgresql Write

    ReplyDelete