title: Data Sync between tables from SQL Server & Db2 - how to delete rows
body: <p>We have two databases one in SQL Server &amp; one in DB2, we have a scenario where we do some data inserts &amp; data updates and deletes in SQL Server &amp; at the same time we also do data inserts updates &amp; deletes in Db2.</p>
  
  <p>We sync data back &amp; forth using some processes, whenever there is a change from SQL Server we sync data to db2 for insert, update &amp; delete, if we have a change in db2 we sync data to SQL Server, we use IBM MQ messages which we dequeue the messages to sync the changes back and forth.</p>
  
  <p>Everything was good until we had some issues of data sync from Db2 to SQL Server, one of our process was down which sync from db2 to SQL Server, so there is an on demand job that runs every night that will do full data refresh from Db2 to SQL Server but we are only doing Merge Update &amp; insert, we are not doing delete as data which is yet to be synced to db2 is also present in SQL Server, so we cannot directly delete as both databases can have more or less records, so data on SQL Server some of them are left orphan, we have a scoping so data which is getting updated in SQL Server cannot be change in db2 and vice versa.</p>
  
  <p>My question is when we are syncing from Db2 to SQL Server, how to identify records that got deleted from db2 only so that we can delete those from SQL Server, we don't want to delete records that are created in SQL Server but yet to be sent to db2, we have 114 tables and we cannot maintain a flag if that is an option to differentiate.</p>