Why does final task not run?

  • In my control flow, I have a Foreach Loop which runs a number of data loads, with the file names and processing method taken from a table, (there are 2 different file formats). Within this, based on an expression value, one or other of two data flows run once per loop, and loads the data into SQL Server 2008 tables. Standard stuff, and it works OK.

    BUT the next step doesn't. Both method boxes connect to an "Archive Files" script task, using a standard "constraint: success" link. So when each processing method completes successfully, that task should run, shouldn't it? But it doesn't!

    Here's a picture of my Control Flow after completing. All the other tasks complete (go green), but the final Archive Files task never runs. There's no mention of it in the log file either. I cannot see any reason why it would not run. But I must be doing something wrong! Help please!

  • looks like you may have a breakpoint set in the script task. Sometimes this throws the code window up behind the executing BIDS window, so you may want to take a look at your taskbar when it's running, see if it's there. While the breakpoint is hit, code execution is stopped, so it won't progress until you F5 or step through within the script/code window.

    HTH,

    Steve.

  • Yes, I did have some breakpoints set, but that's not the reason the code did not run.

    Firstly, I was looking for them. And I know it didn't run 'secretly' either because I'd checked the progress log and the debug output, neither of which make any mention of the 'Archive Files' task.

    Secondly, I've run it all again with all breakpoints removed, and 'Archive Files' STILL does not run.

    I'm still stumped! How can it NOT run?

  • What happens when you execute the task directly (right-click-->execute task) ?

  • On relooking at the diagram, logically it looks like the precedence constraints to the archive should be set to 'OR' not 'AND' because, in a single iteration of the foreach, you'll only have 1 of the 2 file types right (C1 or C2)?

    Steve.

  • Thanks Steve, that's the solution 🙂

    I changed the constraints to OR and NOW IT WORKS 😀

    I thought the OR referred to multiple conditions within the constraint;as you say it actually refers to the linked task. As you deduced, only one of the two preceding tasks runs at a time, hence needing to OR the constraints to run the final 'Archive Files' task if EITHER of the data load tasks completes successfully.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply