February 24, 2010 at 10:51 pm
I have two tables in database.i want to copy data from table a to table b without deletimg data which is present in table b.it should match primary key of both table and those keys are not present in table b then it has two insert that data in table b.how to do this in ssis..i tried it using MERGE JOin .but it is not helpful.please reply me.....
February 24, 2010 at 11:34 pm
There are many methods in which this can be done using T-SQL.
-- Method 1 (Using LEFT JOIN)
INSERTTABLE_B( COL1, COL2, COL3 )
SELECTA.COL1, A.COL2, A.COL3
FROMTABLE_A A
LEFT JOIN TABLE_B B ON A.KEY_ID = B.KEY_ID
WHEREB.KEY_ID IS NULL
-- Method 2 (Using NOT EXISTS)
INSERTTABLE_B( COL1, COL2, COL3 )
SELECTCOL1, COL2, COL3
FROMTABLE_A A
WHERENOT EXISTS( SELECT * FROM TABLE_B WHERE A.KEY_ID = B.KEY_ID )
--Ramesh
February 24, 2010 at 11:38 pm
thanks for your reply....But i want it in SSIs because i want to schedule it everyday through SSIS.
February 25, 2010 at 12:22 am
Put any one of the query in Execute SQL Task in SSIS.
--Ramesh
February 25, 2010 at 12:54 am
Really thanks for ur help..................
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply