Creating Package Control Flow
The control flow in a SQL Server 2005 Integration Services (SSIS) package is constructed by using different types of control flow elements: the containers that provide structure in packages and services to tasks, tasks that provide functionality in packages, and precedence constraints that connect containers and tasks into a control flow.
You create the control flow in a package by using the control flow designer, the design surface on the Control Flow tab in SSIS Designer.
Creating a control flow includes the following tasks:
Adding containers that implement repeating workflows in a package or divide a control flow into subsets.
Adding tasks that support data flow, prepare data, perform workflow and business intelligence functions, and implement script.
Connecting containers and tasks into an ordered control flow by using precedence constraints.
If the control flow includes tasks and containers that connect to data sources, you must also add connection managers to the package. You can add connection managers when working in the control flow designer, but you can also add them when the Data Flow or Event Handlers tab is active.
SSIS Designer also includes many design-time features that you can use to manage the design surface and make the control flow self-documenting.
When the Control Flow tab is active, SSIS Designer shows the design surface for creating the control flow in a package, the Connection Managers area lets you add or modify the connection managers that the package uses, and the Toolbox lists Control Flow Items and the Maintenance Plan Tasks. The Control Flow Items node of the Toolbox lists many types of tasks and containers, whereas the Maintenance Plan Tasks node lists only tasks for maintaining SQL Server databases and jobs.
The following diagram shows the control flow of a simple package in the control flow designer. The control flow shown in the diagram is made up of three package-level tasks and one package-level container that contains three tasks. The tasks and container are connected by using precedence constraints.
Integration Services includes three types of containers that you can use in a control flow.
The Foreach Loop container for creating repeating control flows that use an enumerator to implement looping. For example, the Foreach Loop container can be configured to use the Foreach File enumerator to perform an action on all the files in a folder. For more information, see Foreach Loop Container and Adding Enumeration to a Control Flow.
The For Loop container for creating repeating control flows that evaluate a condition to implement looping. For example, the For Loop container can be configured to repeat a task seven times. For more information, see For Loop Container and Adding Iteration to a Control Flow.
The Sequence container for creating subsets in the control flow to manage multiple tasks as a unit. For example, the Sequence container can be disabled, which in turn disables all the tasks in the container. For more information, see Sequence Container and Using Sequence in a Control Flow.
Integration Services includes a variety of tasks that you can use to create control flow that meets the business requirements of the package. If the package has to work with data, the control flow must include at least one Data Flow task. For example, a package might have to extract data, aggregate data values, and then write the results to a data source. For more information, see Integration Services Tasks and Adding Tasks to a Control Flow.
After you add a task or container to the design surface of the Control Flow tab, SSIS Designer automatically adds a connector to the item. If a package includes two or more items, tasks or containers, you can join them into a control flow by dragging their connectors from one item to another.
The connector between two items represents a precedence constraint. A precedence constraint defines the relationship between the two connected items. It specifies the order in which tasks and containers are executed at run time and the conditions under which tasks and containers run. For example, a precedence constraint can specify that a task must succeed for the next task in the control flow to run. For more information, see Precedence Constraints and Setting Precedence Constraints on Tasks and Containers.
Many tasks require a connection to a data source, and you have to add the connection managers that the task requires to the package. Depending on the enumerator type it uses, the Foreach Loop container may also require a connection manager. You can add the connection managers as you construct the control flow item by item or before you start to construct the control flow. For more information, see Integration Services Connections and Creating Connection Managers.
The SSIS Designer includes two design-time features for control flow.