1

In one of my projects, I've got two simultaneous sequence containers, one of which is executed quite rarely.

My solution was to control the ETL of earlier years with a package parameter - which works great.

Conditional execution of earlier years' ETL

However, after the ETL load I have to perform two tasks:

  1. Perform a 'clean' logout with my source system,
  2. Start DataMart load process

If the 'SEQ Load earlier years' task executes, I HAVE to wait with both tasks until 'SEQ Load earlier years' has completed. But if it doesn't execute, the tasks should execute still.

My initial solution is to solve this with a precedence constraint too, in the following way, but it turns out this will not work:

Whenever 'SEQ Load earlier years' doesn't execute (because the 'PerformFullLoad' parameter is set to False), the bottom tasks ('EPT Load Datamart' and 'SCR Logout') don't execute at all:

Package execution finished: bottom containers have not executed

Of course it's possible to split the functionality in two separate loads (one 'actual' and one 'historical') - but I'm trying to see why SSIS handles this way: I expected that the precedence constraint (set to 'Expression or Constraint') should evaluate to 'True': the Expression evaluates already to true, so there's no need to wait for the sequence container to finish..

So: How can I implement in SSIS a conditional task (in my example: 'SEQ Load earlier years') that is itself conditional for another task (in my example: 'EPT Load Datamart') only if it executes?

Have I overlooked something? Did I use a 'wrong' pattern? (why?) Or is this simply an impossible scenario for SSIS?

1
  • I haven't thought this through, but what if you make SCR Login to SEQ just a standard On Success Constraint. Then inside the container have the Disabled property driven by PerformFullLoad You'll always have the two SEQ containers completing so the dependent tasks should be easier to handle, yeah?
    – billinkc
    Jan 26, 2016 at 15:57

1 Answer 1

2

I could be missing something important. I would suggest adding an expression to the precedence constraint between the SCR and Load Current Tables that is Success and !@[Package::PerformFullLoad]. I would set the Multiple Constraints to OR in anticipation of the next step. That will give you mutual exclusivity in the workflow. Then, I would add another precedence constraint between the Load Earlier Years and Load Current Tables containers. this would default to an OR multiple constraint because of your earlier setting.

This way, when you set $Package::PerformFullLoad, the package will first load the earlier data and then the later data; but if $Package::PerformFullLoad is not set, the package will only load the later data.

I hope this makes sense.

:{>

4
  • It does make sense, although the tables of 'full load' are not covered by the default load - which can be fixed of course (by containing the tasks in another package for example), so it does provide a solution. For my understanding: is it indeed the 'intended' / known behaviour of SSIS to not execute the constrained task if the precedent task didn't complete (as long as it's an AND constraint), even if the precedent constraint evaluates to true due to the 'Expression OR constraint' condition?
    – vstrien
    Jan 26, 2016 at 15:53
  • 1
    Hi again, Vstrien. Precedence constraints are difficult because they're flexible (which also means they're complex). I wrote about them at sqlservercentral.com/articles/Integration+Services+(SSIS)/92901. You can configure a precedent constraint to "evaluate" (my term) based on a number of conditions and expressions. The default behavior is "On Success (of the preceding task)", which really means "the preceding task completed, and completed successfully." That's two different conditions, in my opinion. You can configure a PC to evaluate on completion alone (to be continued)... Jan 26, 2016 at 16:04
  • 1
    (continued) ...or you can add expressions and define the relationship between the results of the preceding tasks execution (success, failure, completion [== don't care whether it succeeded or failed, just that it's done]) and the expressions. The proceeding (constrained) task will not start until a preceding precedent constraint evaluates as True. If two preceding precedent constraints evaluate to True (as in an OR setting for multiple constraints), the proceeding task will only execute once. I'm not sure that answers your question. I hope it does. :{> Jan 26, 2016 at 16:09
  • It sure does :). Thanks!
    – vstrien
    Jan 27, 2016 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.