0

Using SSDT 16.0.61908, SSIS 15.0.2000 and VS Community 16.3.4

I have a package that contains two data flows. I want to use a package-scope variable defined by the user or passed in through a preceding process to determine which data flow to execute.

For example, if the variable indicates "A" then execute data flow 1. If the variable indicates "B" then execute data flow 2.

I'm sure there has to be a simple way to do this but I'm not seeing it in any of the documentation clearly.

Tim F
  • 23
  • 6

2 Answers2

0

Pass in a parameter to the package with either "A" or "B" in your example.

Use a task that doesn't really do anything like an expression.

link the expression to both data flows and condition the path to either A or B.

enter image description here

KeithL
  • 5,348
  • 3
  • 19
  • 25
0

You're looking for a precedence constraint. Add a Sequence Container to your package. Call it Decision Point or something like that. The purpose of this is to have a shared parent for all the executables that need to figure out if it's their turn to run

Then drag the green arrows out from it to your various data flows.

Double click the arrows and change the constraint from Constraint to Constraint and Expression.

SSIS sequence container: Setting conditional parameters for when file is not present

In your expression, you'd do something like @[User::MyVar] == "A" for Data flow 1, @[User::MyVar] == "B" for Data flow 2, etc

If you need then have the same successor to both of them, you'll modify the output path of the various data flows to use an Or precedent constraint.

2 Data Flow Tasks Linking to one Execute SQL Task

billinkc
  • 59,250
  • 9
  • 102
  • 159
  • awesome, like above post, I knew it was a simple piece I was missing somewhere. thanks! – Tim F Apr 16 '20 at 20:40