Question

I have an SSIS package, which depending on a boolean variable, should either go to a Script Task or an Email task.(Note: the paths are coming from a Script Task)

I recall in the old dts designer there was a way to do this via code. What is the proper way to accomplish this in SSIS?

Was it helpful?

Solution

Isn't a Conditional Split a data flow task, which takes a row of data and pushes it in one of two directions according to some property of the data???

Oops, that is correct. I found this blog entry which explains how to do proper control flow conditional branching based on boolean values.

OTHER TIPS

In control flow, drag the green arrow to the email task, then right-click on it and you will see you can set it from 'Completed' to 'Conditional', then you can set an expression on the condition. The arrow will then turn blue. You should then be able to drag another arrow to the other script, and set that to conditional.

I have this set-up often, many times you want to email if a certain condition applies. The standard syntax for the conditional constraints is something like:

@[User::SendEmail] == True

Assuming your SendEmail variable is a boolean. If you use anything else, just construct an expression that evaluates to either true or false.

Remember to set the conditionals to OR instead of AND, otherwise it won't complete unless it can take both routes!

A Conditional Split task does what you want. Add the Conditional Split task, add in an additional output (a default output is provided), and set up the Condition for that output. Then just tie the outputs (default and new) to the Script and Email tasks as appropriate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top