Hello All, I have two tables each having 50 columns and contains 10K rows. Out of 50 around 42 columns are same. Both table has one common keys where I can join data. First table contains incremental data and second historical data. My requirement is to identify the row from firs table where any of values from 42 columns change, if values change I need to make entry in historical data. What is best way to achieve this. I tried EXIST its not working....
I think I would first create a hash column where you create a hash for the 42 columns. When all the 42 columns are the same it will create the same hash. When the hash is not the same you create an update and use the OUTPUT clause to save the historical data.
But maybe you can use temperal tables:
Temporal Tables - SQL Server | Microsoft Docs