Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Delete and update in different tables using SSIS package

$
0
0

Hi Team

Have data in 3 different databases like Archive, Staging and Live.

Live DB : data from Jan 2006 to Dec 2018

Archive DB :  data from Jan 2006 to Dec 2014

Staging DB :  data from Jan 2006 to Dec 2014

Want to delete data in Live DB which is presents in Archive DB mean need data Jan 2015 to Dec 2018 in Live DB. 

Also have created a one SSIS package, if any one tell this is correct or not

Note : while deleting (it is row by row operation) data in Live DB am updating  DeletedDate as current date in Staging DB 

OLEDB source 1: select * from archive..Table1 - am sorting source level 

OLEDB source 2: select ID  from Live..Table1 - am sorting source level 

Lookup transformation : am using Inner Join and column from Live Table as ID_D

Conditional split : expression - isnull(ID_D) -- here am taking default output as input for OLEDB command 1

OLEDB command 1: Delete from Live..Table1 where ID=?

OLEDB command 2: update Staging..Table1 set DeletedDate=Getdate() where ID=?



After executing this package am getting results but count was mismatch in live and archive DB

For example : 

Before executing package : record count in Achive - 2000 and Live - 45000

After executing package : record count in Achive - 2000 and Live - 44300

Results : It delete one 200 records but it suppose to delete 2000 records in Live DB


Thanks Bala Narasimha


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>