Skip to content

SYSTEM_TIME

SELECT *
FROM Sales.Orders
FOR SYSTEM_TIME AS OF '2021-05-01T12:34:56.1234567'
OrderID | CustomerID | ProductID | OrderDate | Quantity
--------|------------|-----------|----------------------------|----------
10248 | VINET | 11 | 2021-04-30T13:34:56.1234567| 12
10249 | TOMSP | 42 | 2021-04-30T14:34:56.1234567| 10

The SYSTEM_TIME temporal table function with AS OF is used to query the data as it existed at a specific point in time. In the example, the query is returning the data from the Sales.Orders temporal table as it existed on ‘2021-05-01T12:34:56.1234567’.