SQLTeam.com | Weblogs | Forums

SQL Stored Procedure to compare change in record



I have a stored procedure to track when shipment number is updated to a table.

The column name is Shipment Number. The values are either TDB (To be determined) or Shipping Number. I am writing a stored procedure that takes all the TDB values and writes it to a different table.

I need to go ahead and check that table and compare it to the other table and see if shipping number was changed from TDB to whatever. Any help on how to do this would be great.


What column do the two tables have in common other than Shipping Number? You need something to join on.


They have shipping ID in common


so something like:

select *
from table1 t1
join table2 t2
 on t1.ShipID = t2.ShipID
where t1.ShipNum <> t2.ShipNum