{"id":14721,"date":"2016-01-11T09:30:00","date_gmt":"2016-01-11T17:30:00","guid":{"rendered":""},"modified":"2024-01-22T22:52:26","modified_gmt":"2024-01-23T06:52:26","slug":"effortlessly-analyze-data-history-using-temporal-tables-2","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2016\/01\/11\/effortlessly-analyze-data-history-using-temporal-tables-2\/","title":{"rendered":"Effortlessly Analyze Data History Using Temporal Tables"},"content":{"rendered":"

Real data sources are never static; critical business information changes over time and important decisions often rely on insights that analysts get from evolving data.<\/p>\n

Users who track data history aim to answer fundamental questions: How did data look in a specific point in time in the past (yesterday, a month ago, a year ago, etc.)?, what changes have been made?, and when and what were the dominant trends in a specific period of time? Without proper support in the database, however, questions like these have never been easy to answer.<\/p>\n

Temporal Tables are a new feature in SQL Server 2016<\/a>, designed to be the ultimate productivity tool for developing or migrating applications that provide insights from historical data. Temporal Tables allow you to track the full history of changes without additional code and let you focus your data analysis on a specific point in time in a very simple and efficient way.<\/p>\n

Getting started with Temporal Tables<\/h1>\n

Temporal Tables keep data closely related to time context<\/strong> so that stored facts can be interpreted as valid only within the specific period<\/strong>. They are also referred to as a system-versioned temporal table<\/strong>, because the period of validity for each row is automatically maintained by the system (i.e. database engine).<\/p>\n

Depending on a scenario, you can either create new system-versioned temporal tables or extend existing ones with temporal attributes.<\/p>\n

When the data in a temporal table is modified, version history is built automatically and transparently without additional action from the end user or application. This property makes Temporal Tables an obvious choice when adding data auditing to existing applications because it is not necessary to change how they interact with the database in order to modify or read the latest (actual) state of data.<\/p>\n

With Temporal Tables, historical data is just one query away, which gives you very efficient point-in-time analysis without additional latency.<\/p>\n

The diagram below depicts a typical user workflow with Temporal Tables:<\/p>\n

\"<\/a><\/p>\n

To get started with Temporal Tables, download the AdventureWorks Database for SQL Server 2016 CTP3<\/a> with script samples and follow the instructions in the folder \u201cTemporal.”<\/p>\n

To learn the different ways to create Temporal Tables and work with them in your applications, check out Getting started with system-versioned Temporal Tables at MSDN<\/a>.<\/p>\n

Typical scenarios<\/h1>\n

Temporal Tables can be used in a wide set of scenarios when you need to track data history. We strongly recommend it in the following use cases due to the huge productivity benefits:<\/p>\n

\"<\/a><\/p>\n