Helpful information and examples on how to use SQL Server Integration Services.
Besides the regular Success and Failure constraints, you can create precedence constraints that are linked to an expression.
In this example, I have a Script Task that determines the course for the workflow.
Besides the pass and fail, I also want to handle a third case that will be executed whenever a special condition is met in the Script Task.
To set this up, I create a new Boolean variable (varSpecialCase), and set the value in my Script Task. Double clicking the “Handle Special Case” constraint brings up the Precedence Constraint Editor, where I can change the way the constraint is evaluated.
Here I’ve set “Evaluation operation” to “Expression”, and used my variable in the expression text. If varSpecialCase has been set to true by the Script Task, the “Handle Special Case” script task will be executed.
One thing to keep in mind: = != ==
(The equals sign is not the same as double equals in the constraint expression!)
I had originally set my expression up using a single equal sign.
As this is still a valid expression, it will validate successfully when you click the Test button.
When you run however, it always fails. After spending a while trying to figure out why my task wasn’t being executed, I finally looked it up the operators in the Integration Services Expression Reference. I’ll definitely look there first, next time!
PingBack from http://paidsurveyshub.info/story.php?title=ssis-team-blog-using-constraints-and-expressions
So will "Handle Success" also run as well as "Handle Special Case" ? If so, how do you create a basic "If x then blah, else blah" type construct?
You'd do it with two separate precedence constraints - one with the "if" expression, and one with the "else".
I hope you don't mind if I share a link to SSIS 2012 Precedence Constraint Video Tutorial that covers most aspects of Precedence Constraint in 6 videos.
Here's the link
When selecting only Expression for the Evaluation operation, the Value becomes greyed out suggesting that it is not applicable, however it must be set to Completion otherwise the task will fail.