I need to exit from an entire package if a data pump task fails in a sequence container.
I thought I'd use a script task to do this but I'd be glad to learn of any way to do this.
Thanks!
Enantiodrom
Hi Enantiodrom: I had to do exactly this same thing in my packages. I first set up a boolean variable named Go_NoGo and used it as a ReadWriteVariable in a Script Task. Then, within the Script Task I set the variable to either True or False, depending on conditions determined by the Script Task.
Then, on the constraint (the line connecting between tasks) between the Script Task and the next task, I put a "Precedence Constraint" that allows execution to continue to the next task only when Go_NoGo is True.
Double-click on the line connecting your Script Task and the next task in the flow. You should see the "Precedence Constraint Editor" open up. I set "Evaluation operation" to "Expression", and set the Expression to @.[User::Go_NoGo]==True
It took a long time to figure out this syntax. Don't know why the "==" is needed, but it works -- a single "=" won't work.
Also, the reference to the variable ("Go_NoGo") appears to be case-sensitive. Type it into the expression exactly as it appears in the Variables dialog. Also, make sure that the variable is global, and not locally-scoped to some task within the project.
When you set up the constraint this way, execution proceeds to the next task only if Go_NoGo is True. Otherwise, the package just ends without generating an error.
Does this make sense? Once I figured out how to create precedence constraints, I use 'em all the time! There just aren't many good examples in books online. Microsoft really needs to catch up on this one!
|||
Try to look into using failPackageOnFailure property. More details at:
http://msdn2.microsoft.com/zh-cn/library/microsoft.sqlserver.dts.runtime.dtscontainer.failpackageonfailure.aspx
Thanks,
Ovidiu Burlacu
|||
Thank you both very much; this is just what I needed.
Jim/Enantiodrom
No comments:
Post a Comment