Home All Groups Group Topic Archive Search About

How to compare two tables of same structure using a hash/checksum

Author
17 Dec 2006 9:51 AM
KarenM
I have a source table and target table of the same structure.

My source table is a staging table I want to read records in my source
table and if the record does not exist in the target table do a insert
if the record is already in the target table I want to do a update if
the non-key fields have changed in the source table.


Here is a simple example:


source_sales is the source table. Target_Sales is the target table.


Source_Sales as the following columns:


Key Columns
     OrderNum
     ItemNum


Non-Key Columns
     OrderDate
      SalesOrg
      DistChannel
      Qty
      Amount


the TargetSales as the same structure as the SourceSales table.

I want to compare each record in source to the target table using
a hash or checksum. I learnt that a hash/checksum is quicker
than anyother comparison.


Thanks
Karen

AddThis Social Bookmark Button