Search code examples
sql-serverssisetlscript-taskforeach-loop-container

SSIS - 2nd Script Task not being executed in Foreach Loop Container


I have 2 script tasks in my foreach loop container in an SSIS package. See picture. The first script task Determine which file is presented gets executed just fine. However, the second one Archive Broker File does not get executed at all.

I can see in the progress that the script tasks gets validated but no execution at all. The only thing it needs to do is to rename a file and move it to a different location.

Any idea what's going on especially since the first script task gets executed without any issues.

Thanks, Daniel

Archive Broker File not being executed


Solution

  • Cause

    It will not be executed if the three data flow tasks are not executed since you are using precedence constraints (link between tasks) with Logical AND condition

    Solution

    Double click on any precedence constraint going from any Data Flow Task to the script Task and change the condition to Logical OR

    Info from official documentation

    Based on Precedence Constraints official documentation:

    Logical AND
    Select to specify that multiple precedence constraints on the same executable must be evaluated together. All constraints must evaluate to True.

    This type of precedence constraint appears as a solid green, highlighted or blue line.

    Logical OR
    Select to specify that multiple precedence constraints on the same executable must be evaluated together. At least one constraint must evaluate to True.

    This type of precedence constraint appears as a dotted green, highlighted, or blue line.


    Other helpful articles

    You can read more about precedence constraints in the following article: