- Audit on SQL Server (Server Audit)
- How to Create an Audit to Monitor Job Creation, Modification, and Deletion in SQL Server
- How to create an Audit trigger to log object manipulation in SQL Server
- SQL Server - How to implement audit and control of logins (Logon Trigger)
- Monitoring DDL and DCL Operations Using SQL Server fn_trace_gettable
- Using SQL Server Standard Trace to Audit Events (fn_trace_gettable)
- SQL Server - Permissions and privileges audit trigger at database and instance level (GRANT and REVOKE)
- SQL Server - How to Monitor and Audit Data Changes in Tables Using Change Data Capture (CDC)
- SQL Server 2016 - How to “Time Travel” Using the Temporal Tables Feature
- SQL Server - How to use auditing to map actual required permissions on a user
- SQL Server - Trigger to prevent and prevent changes to tables
- SQL Server - How to Create a Data Change History for Your Tables (Audit Logs)
- SQL Server - How to Avoid Brute Force Attacks on Your Database
- SQL Server Security Checklist - An SP with more than 70 security items to validate your database.
- SQL Server - How to know the date of a user's last login
- SQL Server - How to Avoid and Protect Against Ransomware Attacks Like WannaCry on Your Database Server
- SQL Server – Beware of server role securityadmin! Using privilege elevation to become sysadmin
- SQL Server - How to Avoid SQL Injection? Stop using Dynamic Query as EXEC (@Query). Now.
- SQL Server - Understanding the Risks of TRUSTWORTHY Property Enabled in a Database
- SQL Server - Password Policies, Password Expiration, Mandatory Password Change, and Login Lockout after N attempts
Hey guys!!
Through this post, I would like to show you a very interesting and useful feature, which is the Temporal Tables. As I already commented about them in the post SQL Server 2016 - News and Features List, where you can retrieve data from a table at any point in time. This means that you can take a “time travel”, visualizing what was the data for a given table at a specific date and time, using simple SQL queries.
This feature has a wide range of possibilities and utilities, of which I can highlight the Slowly changing dimensions BI to implement a dimension whose vision is that of a given date, and also for the purpose of Auditcomparing the past with the present. All without creating triggers and no manual controls.
It is worth mentioning that this feature is available in all editions of SQL Server, including Web Edition and Express.
How do Time Tables Work?
View contentConstraints of a Time Table
View contentWhat tables are temporal in my base?
View contentHow to create a Time Table (Versioned)?
View contentHow to convert a common table to Temporal Table?
View contentHow to query the data from the Time Table?
View contentHow to disable versioning of a Time Table?
View contentWill my history table grow forever?
View contentThat's it folks!
A big hug and even more!
Dirceu, in the tests performed here, I noticed that the dt_ini field is always receiving the datetime + 4 every time the record undergoes an update.
he takes the current time and adds 4 hours and plays on the field.
this also occurs in the history table,
test with sql 2016 express
sql installed location, I checked with select getdate () and the date is correct.
Dirceu, how do you differentiate this feature from Change Tracking and CDC? All three of these features seem to me to achieve the same result as the temporal one, what changes is just the way to access such historical data. Grateful for the attention.
Hi Rodrigo, I will create a new article to answer your question