🗄️ SQL Server: Fix a Temporal Table History Missing a Dropped Column
System-versioned temporal tables automatically carry every existing column into the history table when versioning is enabled, but dropping a column from the current table later doesn’t retroactively remove it from already-recorded history rows — and depending on how the drop was performed, it can also fail to add that same column back to history in a consistent way if the column is later re-added under the same name with a different type.
🔎 The Problem
ALTER TABLE dbo.Employees DROP COLUMN LegacyBadgeId; -- Succeeds. Current table: column gone. -- History table dbo.EmployeesHistory: LegacyBadgeId column -- still exists with old data, now permanently orphaned - any -- query joining current + history on SELECT * will error or -- silently return mismatched schemas depending on the query
✅ Fix: Manage History Schema Changes Deliberately
- Before dropping a column from a temporal table, decide explicitly whether the history table should keep it (for audit purposes) or also drop it — SQL Server’s automatic behavior here only ever acts on the current table, never on history, unless you tell it to.
- If the column should also disappear from history, temporarily set
SYSTEM_VERSIONING = OFF, drop the column from both tables explicitly, then re-enable versioning withSYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.EmployeesHistory)pointing at the now-matching schema. - Avoid
SELECT *against a temporal table’s history in application code or reports entirely — always list columns explicitly, so a future schema drift between current and history tables fails loudly in development instead of quietly in production.
🚨 Why This Is Dangerous
- An audit or compliance query that assumes history always mirrors the current table’s schema can silently skip or misreport older records once a column drop has desynced the two, which is exactly the kind of gap that only surfaces during an actual audit, too late to fix quietly.
Temporal tables promise to remember everything, but only for the columns you tell them to keep remembering.



