SSIS ForEach Loop behaviour

2019-09-09 00:20发布

This is typical ForEach container behaviour:

http://i.stack.imgur.com/ypx7H.png

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.

http://i.stack.imgur.com/GuPV3.png

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-09 00:59

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.

查看更多
贪生不怕死
3楼-- · 2019-09-09 01:04

This turned out to be the solution:

Foo

查看更多
登录 后发表回答