Nisarg Upadhyay shows how to use temporal tables for basic data auditing:
To audit the data changes for a specific table, we should perform the time-based analysis of temporal tables. To do that, we must use the ‘FOR SYSTEM_TIME’ clause with below temporal-specific sub-clauses to the query data across the current and history tables. Let me explain the output of queries using different sub-clauses. Below is the setup:
-
I inserted a product named ‘Flat Washer 8’ with List price 0.00 in the temporal table at 09:02:25 AM.
-
I changed the List Price at 10:13:56 AM. New Price is 500.00.
Temporal tables aren’t going to solve all of your auditing problems but it can be useful.
Comments closed