SQL Server Integration Services
SSIS is a product included with Microsoft’s SQL Server and it is the Microsoft propose for Extract, Transform and Data load. It is also Microsoft’s recommend tool for data cleansing.
SSIS works by building packages, made up of tasks, that can move data around from source to destination and transform it along the way.
Microsoft has produced a simple wizard to handle some of the most common and needed tasks: importing data to one SQL server database from one local or external database or exporting data from a one of our SQL Server databases. The Import and Export Wizard protects us from the complexity of SSIS while allowing us to move data between any of these data sources:
- SQL Server databases
- Microsoft Access databases
- Microsoft Excel worksheets
- Other OLE DB providers
To import some data using the Import and Export Wizard, follow these steps:
- Launch SQL Server Management Studio and log in to your server.
- Open a new query window.
- Create a new database with the name you want:
- CREATE DATABASE Name_DB
- Click the Execute toolbar button to create a new database.
- Expand the Databases node in Object Explorer
- Right-click on the Name_DB database and select Tasks
- Import Data
- Read the first page of the Import and Export Wizard and click Next.
- Select SQL Native Client for the data source and provide login information.
- Select the database we want as the source of the data to import.
- Because we’re importing data, the next page of the wizard will ask us the connection information for our new database, in this case is Name_DB database.
- Select Copy Data From One or More Tables or Views and click Next. (Note that if we only want to import part of a table we can use a query as the data source instead.)
- Select the Tables you want to import
- After select the tables, the wizard will automatically assign names for the target tables.
- Check Execute Immediately and click Next.
- Click Finish to perform the import. SQL Server will display progress as it performs the import.
- Now you have your database with all the imported data.
Working with Connection Managers
SSIS uses connection managers to integrate different data sources into packages. SSIS includes a variety of connection managers that allow you to move data around from place to place.
| Connection Manager | Description |
| ADO | Connecting to ADO objects such as a Recordset. |
| ADO.NET | Uses the .Net Provider to connect to SQL Server 2005 or other connection exposed through managed code (like C#) in a custom task |
| Analysis Services | Connecting to an Analysis Services database or cube. |
| Excel | Connecting to an Excel worksheet. |
| OLEDB | Used to connect to any data source requiring a OLEDB connection (SQL Server 2000 for example) |
| Flat File | Connecting to delimited or fixed width flat files. |
| FTP | Connecting to a FTP data source. |
| MSMQ | Connecting to a Microsoft Message Queue. |
The Import and Export Wizard is simple to use, but it is just a little sample of the functionality provided by the SSIS. To really appreciate the full power of SSIS, you’ll need to use the Business Intelligence Development Studio to build an SSIS package. A package is a collection of SSIS objects including:
- Connections to data sources.
- Data flows, which include the sources and destinations that extract and load data, the transformations that modify and extend data, and the paths that link sources, transformations, and destinations.
- Control flows, which include tasks and containers that execute when the package runs. You can organize tasks in sequences and in loops.
- Event handlers, which are work flows that runs in response to the events raised by a package, task, or container.
To Create a project:
- Launch Visual Studio 2005, 2008.
- Create a Project
- Select Business Intelligence Projects
- Select the Integration Services Project template. You will have your empty SSIS project
To add some connection managers to your package, follow these steps:
- Right click on the Connection Managers Tab and it will display a pop up menu
- It will display the Connection Manager dialog box
- Select New
- The provider select SQL Native Client
- Select the Server Name
- Select Windows authentication or SQL Server authentication
- Select your database
- Click OK
- On the Connection OLE DB manager dialog box Click ok
- Now you will have an OLE DB connection
This is where you tell the SSIS what the package is going to do. You create your control flow, as creating an aspx page, by dragging and dropping controls from the toolbox to the surface, and then dragging and dropping connections between the objects.
The objects available to Drop are divided in four groups:
- Tasks: Different activities than an SSIS package can do, such as execute SQL statements or transfer objects from one SQL Server to another SQL Provider.
- Maintenance Plan tasks: are a special group of tasks that can handle jobs such as checking the database integrity.
- The Data Flow Task is a general purpose task for ETL (extract, transform, and load) operations on data.
- Containers: Objects to hold a group of tasks, such as the Data Flow object.
To add control flows to the package:
- Make sure you are in the SSIS project, and on the Control Flow Tab is selected
- Drag a Data Flow object from the toolbox to the and drop it on the designer page
- This is a simple Idea about how can you create the Control Flow, yo can add more object and connect them selecting the green arrow and dropping on the object you want to connect.
This is where you specify the details of any Data Flow tasks that you’ve added on the Control Flow tab. Data Flows are made up of various objects that you drag and drop from the Toolbox:
- Data Flow Sources: The data get into the system using this.
- Data Flow Transformations: Allow to manipulate the data in different ways.
- Data Flow Destinations: You send the transformed data to this places.
Steps:
This example is a simple use of the data flows, we are going to convert data from one type to an other.
- Select the Data Flow tab
- On the Data Flow Task combo select the Data flow you want to use. In this example we are going to use the “Data Flow Taks” created before
- Drag an OLE DB source from the toolbox and drop it on the designer
- double Click to the source and it will display one configuration dialog box
- The OLE DB Connection manager will display the connection we added before
- select the table or the view you want to use.
- select “Columns” from the list of the left side
- It will display the table columns
- Select the columns you want to use on the work flow
- Drag and Drop a Data Conversion Control
- Drag the green arrow from the OLE DB source and drop it on the Data Conversion Control
- Double left click to the Data Conversion object and it will display one dialog box
- Select the columns you want to manipulate, or to be more specific the columns you want to convert
- Input Column is the selected column, output alias is the data converted on the type selected on the data type column.
- now Drag and Drop an OLE DB Destination
- Drag and drop the green arrow from the Data Conversion object to the OLE DB Destination
- Double click to the object to display the configuration dialog box
- select the OLE DB connection manager, remember you can add all the connection you need on the connection manager explained before. We are using the same because we are converting the data and saving in other table on the same database. You could easily do it between two different databases.
- now go to the list from the left side and select “mappings” it will display the converted data
- Now test it and you have you first SSIS project.
.
Conclusion
This is an application that we can use for data migration, integration, it eases the task of importing and exporting information from different sources, allowing us to define different processes to manipulate, verify and transform the data before loading it into one or several destinations. It allows us to migrate data between heterogeneous databases in a relatively easy and reliable way.
The work flow organization makes creating and defining the different processes, rules and stages that the information must pass through from source to destination an easier task to tackle. Its integration with the Visual Studio IDE makes working with SSIS a natural task to any experienced developer, making the initial learning curve a lot easier to handle.

