Building Packages Programmatically
If you need to create packages dynamically, or to manage and execute Integration Services packages outside the development environment, you can manipulate packages programmatically. In this approach, you have a continuous range of options:
Load and execute an existing package without modification.
Load an existing package, reconfigure it (for example, for a different data source), and execute it.
Create a new package, add and configure components object by object and property by property, save it, and execute it.
You can use the Integration Services object model to write code that creates, configures, and executes packages in any managed programming language. For example, you may want to create metadata-driven packages that configure their connections or their data sources, transformations, and destinations based on the selected data source and its tables and columns.
This section describes and demonstrates how to create and configure a package programmatically line by line. At the less complex end of the range of package programming options, you can simply load and run an existing package without modification as described in Running and Managing Packages Programmatically.
An intermediate option not described here is that of loading an existing package as a template, reconfiguring it (for example, for a different data source), and executing it. You can also use the information in this section to modify the existing objects in a package.
Note
When you use an existing package as a template and modify existing columns in the data flow, you may have to remove existing columns and call the ReinitializeMetaData method of affected components.
In This Section
Creating a Package Programmatically
Describes how to create a package programmatically.Adding Tasks Programmatically
Describes how to add tasks to the package.Connecting Tasks Programmatically
Describes how to control execution of the containers and tasks in a package based on the result of the execution of a previous task or container.Adding Connections Programmatically
Describes how to add connection managers to a package.Working with Variables Programmatically
Describes how to add and use variables during package execution.Handling Events Programmatically
Describes how to handle package and task events.Enabling Logging Programmatically
Describes how to enable logging for a package or task, and how to apply custom filters to log events.Adding the Data Flow Task Programmatically
Describes how to add and configure the Data Flow task and its components.Discovering Data Flow Components Programmatically
Describes how to detect the components that are installed on the local computer.Adding Data Flow Components Programmatically
Describes how to add a component to a data flow task.Connecting Data Flow Components Programmatically
Describes how to connect two data flow components.Selecting Input Columns Programmatically
Describes how to select input columns from those that are provided to a component by upstream components in the data flow.Saving a Package Programmatically
Describes how to save a package programmatically.
Reference
- SSIS Error and Message Reference
Lists the predefined Integration Services error codes with their symbolic names and descriptions.
Related Sections
Extending Packages with Scripting
Discusses how to extend the control flow by using the Script task, and how to extend the data flow by using the Script component.Extending Packages with Custom Objects
Discusses how to create program custom tasks, data flow components, and other package objects for use in multiple packages.Running and Managing Packages Programmatically
Discusses how to enumerate, run, and manage packages and the folders in which they are stored.Data Flow Properties Reference
Documents the custom properties of the built-in Integration Services data flow sources, transformations, and destinations.
External Resources
CodePlex samples, Integration Services Product Samples, on www.codeplex.com/MSFTISProdSamples
Blog entry, Performance profiling your custom extensions, on blogs.msdn.com.
|