Deleting rows linking sources from different databases
hi experts,
find below requirement, please suggest how go it?
1. first source sql server joining 2 tables (query)
2. second source mdb database (table)
3. delete matching rows table mdb database linking source mentioned in step 1.
4. insert rows step 1 table in mdb
scenario: loading data query (sql source, step 1) table in mdb (step 2). if run package again & again, should not insert data mdb, instead, should remove matching rows target (matching rows determined 3 columns) , re-insert matching source rows target that, multiple run should not result in duplicates in target.
please let me know steps go this.
thanks in advance
regards,
naveen
naveen j v
you can of merge statement in code below, here comment out part can join multiple tables in step 1
create table #source (id int, srctexts varchar(10)) create table #dest (id int, desttexts varchar(10)) insert #source values(1,'test1'),(2,'test2'),(3,'test3') merge #dest target using (select id, srctexts #source) source --join tab1 soh --on sod.salesorderid = soh.salesorderid on (target.id = source.id) when matched delete when not matched target insert (id, desttexts) values (id, srctexts); select * #dest select * #source drop table #dest drop table #source
cheers,
amit tomar
---------------------------------------------------
please mark answer if solved query
please vote helpful if solved query
---------------------------------------------------
my blog my wiki page
SQL Server > SQL Server Integration Services
Comments
Post a Comment