Compare table contents

  • Hi,

    here is my problem:

    every day data is loaded into a table with a load-date and time inserted. I need to figure out which records have changed from one upload to the next, which ones where added, changed or deleted. What would be the easiest (and quickest) way to do this?

    Thanks

    Jochen

  • Left Join,Inner Join, Right Join

  • Brevity is good, how do you pronounce your name 5409045121009? Do you put the stress the second 4?

    You could use a trigger on the table that writes to an audit table, I have used the following format for an audit table before now:

    primary_key_value,

    old_value,

    new_value,

    change_type,

    audit_date

    If you have your load table and its source you can compare them using joins. If you only have one table that is periodically updated then you need to have a copy of that table made so that you can compare it on the next day.

    If you don't have two tables or use an audit technique then you won't be able to differentiate between updates and inserts, and deletes will certainly be lost.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply