[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 645
  • Last Modified:

Problem understadning Control Flow in SSIS

Im having a problem understanding how control flow works in an SSIS  package.
I created a simple model using just Script tasks as my practice packagejust to make it as simple as possible.

Heres my observation:
Lets say I have a 3 tasks.  First I have one called Task1.  Below this I create two other tasks called Success and one called Failure.  Using the designer, the green On Success line goes from Task1 to the Success task.  The red On Failure line connects Task1 to Failure.  I then edit the Task1 script so the  last line reads:
Dts.TaskResult = Dts.Results.Success

When I run the package, As expected, the flow leads from Task1 to Success.  If I edit the Task1 script so the last line reads:
Dts.TaskResult = Dts.Results.Failure
The flow leads from Task1 to the Failure task.

Again, this is all running as expected.

Now, I create an additional task called Task2.  Its independent of Task1 and has no precedent.  I have the script for Task2 return a Success result.  Strangely, when I connect the red On Failure line from Task2 to the SAME Failure task that Task1 points to and run it, when Task1 fails it does NOT flow to the Failure task as it should.  

Now, If I have Task2s OnFailure flow to its own failure task, everything works fine.

Can two or more tasks not flow into the same task?

example1.jpg
0
aesmike
Asked:
aesmike
  • 3
1 Solution
 
reb73Commented:
This is the expected behaviour.

When you have two separate tasks flowing to a common target, both of them become precendence constraints to this target and the target task will execute only if both the sources execute with the targeted result to pass control to this target.




0
 
HoggZillaCommented:
>Can two or more tasks not flow into the same task?
Yes, if you want the task to run based on either then change your constraint.  Logical OR


logical-OR.bmp
0
 
aesmikeAuthor Commented:
ahhhhh, thanks!
0
 
aesmikeAuthor Commented:
Ooops, I may have jumped the gun on this being solved.  I set the logic OR for the constraints and it still didn't fire.  See Image below
0
 
aesmikeAuthor Commented:
Geeze, never mind!
I had that failure step disabled!

Problem solved as you two suggested
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now