Search code examples
sql-server-2008ssisflat-file

Insert/Update rows in a table from flat file


I have few text and excel file, from which I need to import data to SQL Server tables. Now my issue is this that the table might already have the same row what I am importing from flat file or excel file.

So, how can I validate and redirect those rows which are already present in the table.

Ex:

Flat file

6, test1, bak
7, test2, nim
8, test3, kol

Table _ product

Id (*Not a primary key*) Name code
1                     ttest  hyt
2                     jtest  jte
7                     test2  nim
6                     ttt    bak

So from flat file row 6 will be updated (because one of the column value is changed), row 7 will not inserted/updated (because it is already there) and row 8 will be inserted.


Solution

  • I believe you know how to configure the oleDBSource and the OleDBDestination, right? The only difference is that in the middle you will have to add a Lookup Transformation who will check if the line exists or not and if it does it will send the data flow to your destination.

    Look on the internet for simple examples on how to use, but be careful that the behavior of this component changed from SSIS 2005 to SSIS 2008 so make sure to look for 2008 examples