Is it possible to create temporal table in Azure synapse datawarehouse

405 Views Asked by At

I m trying to create temporal table in azure synapse datawarehouse.

    CREATE TABLE dbo.Department
(
    DeptID INT NOT NULL PRIMARY KEY CLUSTERED
  , DeptName VARCHAR(50) NOT NULL
  , ManagerID INT NULL
  , ParentDeptID INT NULL
  , ValidFrom DATETIME2 GENERATED ALWAYS AS ROW START NOT NULL
  , ValidTo DATETIME2 GENERATED ALWAYS AS ROW END NOT NULL
)
WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.DepartmentHistory));

i m getting parse error enter image description here

1

There are 1 best solutions below

0
Stuart J Cuthbertson On

As of August 2023, the Microsoft Learn (documentation) page Transact-SQL features supported in Azure Synapse SQL does not explicitly mention temporal tables or the FOR SYSTEM_TIME clause, but the section on SELECT statements does mention that

SELECT statement is supported, but some Transact-SQL query clauses [...] are not supported.

The documentation page for temporal tables themselves lists which versions of SQL Server it applies to, and does not include Synapse DW in that list: screenshot from Microsoft Learn, "Temporal Tables" page: Applies to SQL Server 2016 and later, Azure SQL  Database, and Azure SQL Managed Instance

Combined with the fact that you got a syntax error when you tried, it seems certain that this language feature is not currently supported in Azure Synapse DW. This may, of course, change in the future.