Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 .

like image 562
kuldeep verma Avatar asked Aug 10 '26 12:08

kuldeep verma


1 Answers

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

like image 141
Diego Avatar answered Aug 14 '26 01:08

Diego



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!