You are on page 1of 23

SSIS 2012 Tutorial:

Import Data from a Single Table


J.G. Zheng
Fall 2012
IT 4903
Business Intelligence
Overview
Use SQL Server 2012 Data Tools
Integration Service Project

Importing data from an unnormalized
single table to normalized fact/dimension
tables
2
Data
3
Put this Excel file to a folder. Or
export this to a CSV file if Excel
source does not work later. The
Excel file is attached.
Normalize the table and create
the structure in SQL Server; or
use the script attached.
Create a SSIS Project in Data Tools

4
Set this to false to work with
Excel.
Create a Control Like this with 3
Data Flow Tasks

5
Create the "manager" Data Flow

6
Configure the 4 tasks in the
following 4 slides
Grab a Excel Source and Configure

7
Create a new connection for Excel.

If you have trouble in this step.
Work with a CSV file (exported
from the Excel file) instead. Then
use the flat file source task
instead.
Configure the "Derived Column"
task

8
Splitting Manager
column to two columns
Configure the Sort task

9
The purpose of sort
is all about this
Need the two new
derived columns
Configure the Destination
10
Use the SQL Server
connection already created;
if not, create a new one -
see next slide
Create the mapping
Select destination
table
Create a New SQL Server
Connection

11
Use (local) as server
name
Second Data Flow: product

12
The source is the same,
you can just copy last
one created to here
Configure the next 3 tasks in
the following 3 slides
Use Derived Column to split product

13
Splitting Product to
two columns
Configuring Sort

14
The purpose of sort
is all about this
Need the two new
derived columns
Configuring Destination

15
Create the mapping
Select destination
table
Third Data Flow: sale fact
16
The source is the same,
you can just copy last
one created to here
Configure the next 3 tasks in
the following 3 slides
Derived Column

17
Split all columns
like we did before
Use a "Lookup" task

18
This is the dialog when
you link the derived
column to the lookup task
in the design pane
Configuring Manager Lookup

19
Need to find the mid for each
manager. The lookup source
is from SQL server (after
manager data is imported)
Get mid for a match
of first name and
last name
Configuring Destination

20
Get the mapping
correct
Execute/Debug the Package

21
You may have duplicate data (primary key value)
problems if you run the package the second
time, especially in the product table. A quick way
to solve this is to delete all data in the product
table before you execute the package.
Verify Data in SQL Server

22
Possible Problems
No Excel installed - possible connection error
Download and install the Excel OLEDB runtime (32 bit):
AccessDatabaseEngine.exe
http://www.microsoft.com/en-
us/download/details.aspx?id=13255

Excel OLEDB error
Data Tools does not work with 64bit Excel
See slide #4

Execution error on products table
Existing data in tables (particularly products)
Delete all data first if there is any

Splitting in derived columns is not quite right.
Use substring function to better split columns.
23

You might also like