Temporary tables are designed to give you accurate information about your data, and not about the state - this does not actually understand the state. Nothing lets users understand how the row arrived in the time history table.
If you do not temporarily suspend / stop system version control in your temporary table, you just need to find the delta between the history table and the active table. All other rows in the history table that do not have a corresponding row in the active table are deleted rows.
For example, if you have tblCustCalls and it is enabled for temporary with tblCustCallsHistory, then it seems to be SELECT * FROM tblCustCallsHistory WHERE ID NOT IN (SELECT ID FROM tblCustCalls) . In this example, the identifier is the primary key. You can optimize TSQL if the tables are very large, but the basic concept does not change.
source share