網頁

2012年4月19日 星期四

Lookup Transformation in SSIS (Part-1)

When I design a ETL package for importing Oracle some data to SQL Server by SQL command, that is “Select data from Oracle in the time duration”, it is successful for me to do it.
Data Source ViewScreenHunter_02 Apr. 02 11.56
Execute Debug mode and it is successfulScreenHunter_145 Mar. 28 20.58
If repeat the above step “start debugging”, the same data will be import again. That is duplicated data in database now.
View Imported data by SQL commandScreenHunter_03 Apr. 02 12.04
How to resolve this problem? I want
"If Imported data is the same as SQL data and one field is corrected, this record will overwrite the SQL data.”
"If imported data is the same as SQL data but no field is changed,this record will be ignored.”
"If imported data is new,the record will insert directly it into SQL database.”
For the above target, I will correct the original SSIS Package for satisfying the necessity.

(1).Add "Lookup" Data Flow Transformation
In Solution Explorer, select the original SSIS Package as "Package Lookup.dtsx" next to click "Data Flow" tab.
ScreenHunter_27 Apr. 09 12.23
Right-Click the green line between "Data Conversion" and "SQL Server Destination" next to select "Delete" in menu.
ScreenHunter_28 Apr. 09 12.24
Click the Data Flow Transformation as "Lookup" in the left panel
ScreenHunter_29 Apr. 09 12.25
Drag & Paste it to the empty space of Data Flow Task.
ScreenHunter_30 Apr. 09 12.25
Click green arrow in Data Conversion
ScreenHunter_31 Apr. 09 12.25
Drag & Paste it to Lookup
ScreenHunter_32 Apr. 09 12.26
So does that it will create a green line between Data Conversion and Lookup
ScreenHunter_34 Apr. 09 12.26
Click a green arrow in Lookup
ScreenHunter_35 Apr. 09 12.27
Drag & Paste it to  SQL Server Destination
ScreenHunter_36 Apr. 09 12.27
When you release mouse, the "Input Output Selection" Windows will show up.
ScreenHunter_37 Apr. 09 12.27
In Output field, select "Lookup No Match Output"
ScreenHunter_38 Apr. 09 12.27
Click OK button
ScreenHunter_39 Apr. 09 12.27
The Data Flow will be built now.
ScreenHunter_80 Apr. 09 14.31

沒有留言:

張貼留言

Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.