Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

selectively execute task in ssis control flow

I have a SSIS package with a control flow containing a bunch of execute sql tasks in a sequence.

I need to check a flag for each of the tasks and run the task if it is set, if not skip and go to the next one.

Each of the these task executes a stored proc. So i can check in the proc and "Return" if not set. I was looking for a "SSIS" solution if any.

TIA

PS

like image 263
ps. Avatar asked May 10 '10 15:05

ps.


2 Answers

I think your question was the same as mine in which I wanted to control execution of a task "inline" in my control flow.

The easiest way that I have found doesn't involve expression on the data connectors between the control flow objects but rather using expressions on the control object itself and setting the "Disable" value using an expression. This way on execution, the object is either skipped or not based upon the expression evaluation.

As an example, I wanted to execute a "Execute SQL Task" to remove my indexes based upon whether a variable named "ExtractType" was equal to "Full". If it was then I wanted to remove the indexes on my tables before doing my full load.

like image 171
Amos Wood Avatar answered Oct 27 '22 00:10

Amos Wood


Between your control flow tasks, click on the arrow and choose Edit. When you do this, you get a dialog that allows you to check the "constraint" (success, completion or failure) of the task, an "expression" (i.e. you can have your execute sql task return a value, store that value in a variable, and check the value of that variable in an expression to determine whether to continue down the path you are editing), an "expression and a constraint", and an "expression or a constraint". These last two are the same except for the logic. "Expression and constraint" requires a true condition on both the expression and the constraint, "expression or constraint" requires a true condition on only one of the expression and the constraint.

like image 23
William Salzman Avatar answered Oct 26 '22 23:10

William Salzman