Where can I get SQL Server Transaction Begin Time from?
5
votes
3
answers
4520
views
I am working with temporal tables in SQL Server and the generated time is the transaction begin time in UTC
datetime2
.
Is there a function or table in SQL Server to get that same transaction begin time to use elsewhere that does not require me to write to and select from a system versioned table first?
I have some non-system versioned tables that are part of the same transaction, and I would prefer if the datetime2
recorded against them matched instead of using SysUTCDateTime
and having it vary.
I tried to pull it from sys.dm_tran_active_transactions
but it is datetime
and local server time and appear to be different.
* system versioned: 2017-04-11 14:00:59.4690673
* active transactions: 2017-04-11 15:00:59.467
Asked by Trotts
(151 rep)
Apr 11, 2017, 02:09 PM
Last activity: May 28, 2023, 08:19 AM
Last activity: May 28, 2023, 08:19 AM