开发者

Using SSIS 2008 R2 to load only new data into an existing table from an excel (xls) file

开发者 https://www.devze.com 2023-04-12 22:28 出处:网络
I would like to be able to load data from an excel file into a table within SQL server 2008 R2 via SSIS. However if a cell value is not defined within the excel source, then the original table data sh

I would like to be able to load data from an excel file into a table within SQL server 2008 R2 via SSIS. However if a cell value is not defined within the excel source, then the original table data should not be changed during the data load. The ID column is used to define unique records.

Below are example data sets, that demonstrate the desired result.

Inputs:

Excel File Format
+----+-------+-------+
| ID | Col_A | Col_B |
+----+-------+-------+
| 1  | apple |       |
| 2  |       | fork  |
| 44 | peach | knife |

Table - Before Data Load
+----+-------+-------+
| ID | Col_A | Col_B |
+----+-------+-------+
| 1  | pear  | spoon |
| 2  | orange|       |
| 3  | grape |       |

Desired Resulting Table: (After Merge/Update via SSIS into SQL Server 2008 R2)

Table - After Data Load
+----+-------+-------+
| ID | Col_A | Col_B |  //Comments based on the tables perspective
+----+-------+-------+
| 1  | apple | spoon |  //Col_A updated based on excel dataset value; Col_B unchanged
| 2  | orange| fork  |  //Col_A unchanged; Col_B updated based on excel dataset value
| 3  | grape |       |  //No changes. ID was not defined in excel dataset
| 44 | peach | knife |  //New inserted row from excel datas开发者_如何学Cet

Any help greatly appreciated.


You can use the Slowly Changing Dimension task in the SSIS to manage that

0

精彩评论

暂无评论...
验证码 换一张
取 消