1

Is there a way to get the exact time that SQL Server will use in a temporal table? My goal is to save it in an audit-like record so that I can link some information with the specific version of the row that was changed.

Motivation: I could then get the version that was created during that transaction by using AS OF saved_time and I could easily get the version that existed before by querying the Historical table on sysEndTime = saved_time.

Looking at query plans, it seems what I want is internally systrandatetime() but that is not exposed to T-SQL code.

I tried to use transaction_begin_time from sys.dm_tran_active_transactions but it's not exactly the same.

jods
  • 119
  • 1

0 Answers0