问题
This is typical ForEach container behaviour:
However, if I do whats shown in the image below, the Execute SQL task never executes, how can i do this behaviour? I do not have to use ForEach container if some other type of container will allow me to do this.
The for each loop essentially loops through files in multiple subdirectories in a folder. Based on which folder the loop is in, it populates a variable. this variable is used in the connectors from "some script" task to "task a" and "task b" to decide which task will run. So it is possible that both tasks will run if files are detected in the folders associated with the tasks.
What I really need is for both task a and b to go to the same database task upon completion.
回答1:
You have two output paths from "Some Script Task". Those are connected to "task A" and "task b" via a precedent constraint. That precedent constraint is green - so success but it also has a glyph/adornment attached so that indicates there is also an expression that must be satisfied for that that constraint to be satisfied.
I assume that only A or b fires, right?
So, since only A or b could ever run, then the "Update result in DB for task" will be waiting forever for both of them to complete.
The resolution then is to change the multiple constraints section of the precedent constraint leading into that Execute SQL Task to go from Logical AND
to Logical OR
. Double click either connector and change it there. Both should now show as a green dashed line.
回答2:
This turned out to be the solution:
来源:https://stackoverflow.com/questions/32104639/ssis-foreach-loop-behaviour