SQL Server Integration Services (SSIS) Data Flow


By:

Overview
This is our fourth step in creating a simple SSIS package from scratch.  In this section we will take a look at the Data Flow designer which contains the various tasks that will be performed by a Data Flow task specified in the Control Flow. 

Explanation
To begin launch BIDS by selecting SQL Server Business Intelligence Development Studio from the Microsoft SQL Server program group.  Click File, Open, Project / Solution on the top level menu to display the Open Project dialog.  Navigate to the location of the solution as shown below then click Open:

pen project

Expand the SSIS Packages node under the Tutorial-Sample-1 project in Solution Explorer and you will see the following:

olution explorer open package

Double click on the SSIS package CreateSalesForecastInput.dtsx to open the package.  Click on the Data Flow tab in the designer and you should see the empty Data Flow designer as shown below:

mpty data flow

The Toolbox will now display the tasks that are available in the Data Flow as shown below:

oolbox data flow

As you can see there are quite a few built-in tasks available.  For our current package we want to retrieve some data from the AdventureWorksDW database and output it to an Excel spreadsheet.  To do this we need an OLE DB Source and an Excel Destination.  In addition we need to add a column to the Data Flow; this column will be the numeric column in the spreadsheet where the user enters the forecast amount.  Drag and drop an OLE DB Source, Derived Column, and Excel Destination from the Toolbox onto the Data Flow designer.  After doing so the Data Flow designer should look like this:

ata flow with tasks

The red icons inside of the tasks are an indicator that there is some configuration required.  Right click on the OLE DB Source then select Edit from the popup menu.  This will open the OLE DB Source Editor on the Connection Manager page.  Fill in the dialog as shown below:

ledb source connection

We setup the OLD DB connection manager in the Connection Managers step earlier.  The SQL command text contains a simple query to retrieve the list of cities and states in the United States.

Click on Columns to display the column mappings as shown below:

ledb source columns

By default all columns returned from the query are selected and the Output Column names are the same.  The Output Column names can be edited; we will leave them as is.  Click OK to complete the OLE DB Source Editor.  You will now see a green and a red line dangling from the OLE DB Source task on the Data Flow designer.  The green line is the normal data flow; the red line is the error flow.  Drag the green line and connect it to the Derived Column task as shown below:

ata flow task stage1

Notice that the red icon is now gone from the OLE DB Source task and it is now properly configured.

The Derived Column task allows us to add a column to the Data Flow.  Right click on it, select Edit, then fill in the Derived Column transformation Editor as shown below:

erived column editor

We have now added a new currency column to the data flow with a name of Forecast, and a value of 0.  Click on the Derived Column task and drag the green arrow to connect to the Excel Destination task.

Right click the Excel Destination task and select Edit from the popup menu.  The Excel Destination Editor dialog will be displayed.  Click the New button next to the Name of the Excel Sheet to display the Create Table dialog as shown below:

reate table

The Create Table dialog allows us to create a new table in the Excel spreadsheet.  The columns and their types are determined by the data flow.  We configured an OLE DB Source task that executes a query and a Derived Column task that added the Forecast column to the data flow.  You can edit the CREATE TABLE script if you like.  Click OK on the Create Table dialog and the Excel Destination Editor Connection Manager page will look like this:

xcel destination connection

We configured the Excel Connection Manager in step two of this tutorial.  Click on Mappings to display the Mappings page as shown below:

xcel mappings

The above dialog sets the Destination Column names to the Input Column names by default.

At this point we have completed the Data Flow. Note that there are no longer any red icons in the task rectangles. We will proceed to the final step in this section of the tutorial and execute the package.

 

 






Comments For This Article




Tuesday, May 30, 2023 - 9:22:10 AM - RAYMOND BARLEY Back To Top (91235)
I don't recall the timeframe when this version of the SSIS tutorial was written. However, there is a later that you should use: https://www.mssqltips.com/sqlservertutorial/9053/sql-server-integration-services-ssis-2016-tutorial/

Sunday, May 28, 2023 - 3:32:42 AM - DODER Back To Top (91229)
currency [DT_CY] NOT AVAILABLE.
Not mentioned how to select this data type.

Tuesday, April 26, 2016 - 4:32:25 AM - Vitthal Back To Top (41336)

good... 

 


Wednesday, March 16, 2016 - 12:29:11 AM - Naresh Back To Top (40946)

 kindly

Hi Ray,

I am facing the below issue while adding the Excel destination

I choose the OLE DB connection manager for it. I change the Data access mode to 'Table or view'. I click "New" where it says "Name of the Excel sheet." I get this message: "There is no sufficient information about mapping SSIS types to data types of the selected .NET data provider. As a result, you may need to modify the default column types of the SQL statement on the next screen." 

I click OK. Then this SQL code appears in a dialogue box:
CREATE TABLE `Excel Destination` (
`record_id` INT,
`failure_reason` VARCHAR(255)
)

(Note: I have tried changing 'failure_reason' to NVARCHAR(255), to no avail.)

Click OK and move to the mappings area. The available input and available destination columns are the same, and already mapped. (record_id=>record_id; failure_reason=>failure_reason).

Click OK and return to the Data Flow pane where there is now a red error icon in the top right corner of the Excel Destination object. Hover the mouse over it and the tooltip says: "The Number of Input COlumns for Excel Destination.Inputs[Excel Destination Input] cannot be zero".

kindly help to resolve this.















get free sql tips
agree to terms