w3resource

How to Disable System-Versioning on a Temporal Table


Disabling System-Versioning on a Temporal Table

Write a SQL query to disable system-versioning on a temporal table.

Solution:

-- Disable system-versioning on the Employees table.
ALTER TABLE Employees SET (SYSTEM_VERSIONING = OFF);

Explanation:

  • Purpose of the Query :
    • The goal is to demonstrate how to disable system-versioning on a temporal table.
  • Key Components :
    • ALTER TABLE: Modifies the table to disable system-versioning.
    • SYSTEM_VERSIONING = OFF: Stops tracking changes and detaches the history table.
  • Why Disable System-Versioning? :
    • Disabling system-versioning allows schema changes or maintenance tasks on the table.
    • It reduces storage overhead if historical tracking is no longer needed
  • Real-World Application :
    • In development environments, disabling versioning simplifies testing and debugging.

Additional Notes:

  • After disabling, manually manage the history table if needed.
  • Re-enable system-versioning after completing tasks.
  • Important Considerations:
    • Backup the history table before disabling system-versioning.

For more Practice: Solve these Related Problems:

  • Write a SQL query to disable system-versioning on a temporal Employees table for schema updates.
  • Write a SQL query to temporarily disable versioning on a Products table during a bulk data import operation.
  • Write a SQL query to stop tracking changes in a temporal Orders table while performing maintenance tasks.
  • Write a SQL query to disable system-versioning on a temporal Customers table before migrating historical data.

Go to:


PREV : Retrieving All Versions of a Specific Row.
NEXT : Enabling System-Versioning on an Existing Table.



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.