kuldeep verma
kuldeep verma

Reputation: 326

SQL Query for appending rows into destination using SSIS

I have Created a SSIS Package for Importing the Records from One Table to Another table . It is Working Properly But In Source table records are increasing on regular basis . Therefore I am executing package regularly . In Package Before inserting New rows I truncate the records from Destination table then Executing Package .

        SQL TASK -1 

        Truncate table "OLE DB Destination"

        SQL TASK -1 

        CREATE TABLE "OLE DB Destination" (

           "ZZCOIL_APPR10" NVARCHAR2(20),
           "ZZSTORAGE_LOC10" NVARCHAR2(15),
           "ZZDETAIL1" NVARCHAR2(40),
           "ZZTOTAL_QTY" NUMBER(7, 2),
           "ZZNOTE1" NVARCHAR2(100),
           "ZZNOTE2" NVARCHAR2(100)
                                           )

But I don't Want that solution , I want to insert Only Remaining Records which are not present in Destination table .

Upvotes: 3

Views: 2845

Answers (2)

user1104946
user1104946

Reputation: 690

you can use table difference component in ssis.....

Upvotes: 0

Diego
Diego

Reputation: 36126

you need a lookup transformation.

You will have something like this:

enter image description here

so your component will have the lookup query as "select ID from DestinationTable" for example and you will match them by ID. All the IDs from source that are not found on your destination table will be sent to the "Lookup No Match Output" path, and then you insert them

There are several example on how to use this component over the internet. Here is one

Upvotes: 2

Related Questions