Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 2.28 KB

sys-database-ledger-transactions-transact-sql.md

File metadata and controls

38 lines (30 loc) · 2.28 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic dev_langs monikerRange
sys.database_ledger_transactions (Transact-SQL)
sys.database_ledger_transactions (Transact-SQL)
VanMSFT
vanto
05/23/2023
sql
system-objects
reference
TSQL
=azuresqldb-current||>=sql-server-ver16||>=sql-server-linux-ver16

sys.database_ledger_transactions (Transact-SQL)

[!INCLUDE SQL Server 2022 Azure SQL Database Azure SQL Managed Instance]

Captures the cryptographically protected history of database transactions against ledger tables in the database. A row in this view represents a database transaction.

For more information on database ledger, see Ledger.

Column name Data type Description
transaction_id bigint A transaction ID that is unique for the database (it corresponds to a transaction ID in the database transaction log).
block_id bigint A sequence number identifying a row.
transactional_ordinal int Offset of the transaction in the block.
commit_time datetime2(7) The time of the committing transaction.
principal_name sysname The name of the user who started the transaction. Captured by calling ORIGINAL_LOGIN().
table_hashes varbinary(max) This is a set of key-values pairs, stored in a binary format. The keys are object IDs (from sys.objects) of ledger database tables, modified by the transaction. Each value is a SHA-256 hash of all row versions a transaction created or invalidated.

The binary format of data stored in this row is: <version><length>[<key><value>], where

- version - indicates the encoding version. Length: 1 byte.
- length - the number of entries in the key-value pair list. Length: 1 byte.
- key - an object ID. Length: 4 bytes.
- value - the hash of rows the transaction cached in the table with the object ID stored as the key. Length: 32 bytes.

Permissions

Requires the VIEW LEDGER CONTENT permission.

See also