System-Versioned Temporal Tables – A Case Study


I recently faced an issue related to managing and maintaining my system-versioned temporal tables. Out of the blue, our dev/test database was full of weird tables. Dozens of them. With those long names, ‘MSSQL_TemporalHistoryFor_‘ followed by several numbers and letters.

The source was obvious: they were historical tables that work together with the temporal ones to keep track of data versioning. But why so many and what should we do with them?

The Basics

Whenever we create a temporal table, a historical object will be created and linked to the main table. While the main object keeps the current version of