Understanding the difference between the Control Flow and Data Flow tabs represents one of the
largest learning curves for a new SSIS developer. The easiest way to keep them straight is to think
of the Data Flow tab as simply a way to configure the Data Flow Task. This separation gives you a
huge amount of power when configuring the task. The other way to differentiate the two tabs is that
the Control Flow tab handles the workflow of the package and ties the tasks together, whereas the
Data Flow tab handles a data load.
Control Flow
The Control Flow contains the workflow parts of the package, which include the tasks, containers,
and precedence constraints. SSIS has introduced the new concept of containers, which was briefly
discussed in Chapter 1 and is covered in detail in Chapter 6. In the Control Flow tab, you can click
and drag a task from the SSIS Toolbox into the Control Flow design
pane. Once you have a task created, you can double-click the task to
configure it. Until the task is configured, you may see a yellow warning
or red error indicator on the task.
After you configure the task, you can link it to other tasks by using
precedence constraints. Once you click the task, you’ll notice a green
arrow pointing down from it, as shown in Figure 2-14.
For example, to create an On Success precedence constraint, click the green arrow coming out of
the task and drag it to the task you wish to link to the first task. In Figure 2-15, you can see the On
Success precedence constraint between an Execute Process task called EPR - Run Notepad and an
Execute Process task called EPR - Run Calc.
In the Data Flow tab, when you click a source or a transformation, you’ll
also see a blue and red arrow pointing down, enabling you to quickly direct
your good (blue) or bad (red) data to a separate output. Therefore, if you run
a formula that returns an error in the Data Flow, that single row could be
outputted to a different table, and then all other rows could continue down
the proper path.
In the Control Flow, though, you need to use a different approach. If
you want the next task to execute only if the first task has failed, create a precedence constraint
as shown earlier for the On Success constraint. After the constraint is created, double-click the
constraint arrow. You’ll be taken to the Precedence Constraint Editor (see Figure 2-16).
Use this editor to set what type of constraint you’ll be using. Three options are available in the Value
dropdown field: Success, Failure, or Completion. A success constraint will fire the second task or
container only when the first task or container succeeds. A failure constraint executes the second
task or container only when the first task fails. The last scenario is a completion constraint, which
will execute the second task or container whether the first task succeeds or fails.
In SSIS, you have the option to add a logical AND or OR when a task has multiple constraints. In the
Precedence Constraint Editor in SSIS, you can configure the task to execute only if the group of
predecessor tasks has completed (AND), or if any one of the predecessor tasks has completed (OR).