anybody has seen any examples of a table with multiple versions for each record
something like if you would had the table
Person(Id, FirstName, LastName)
and you change a record’s LastName than you would have both versions of LastName (first one, and the one after the change)
I’ve seen this done two ways. The first is in the table itself by adding an
EffectiveDateandCancelDate(or somesuch). To get the current for a given record, you’d do something like:SELECT Id, FirstName, LastName FROM Table WHERE CancelDate IS NULLThe other is to have a global history table (which holds all of your historical data). The structure for such a table normally looks something like
Then you set a trigger on your tables (or, alternatively, add a policy that all of your Updates/Inserts will also insert into your HX table) so that the correct data is logged.