Επεξεργασία

Κοινή χρήση μέσω


sys.database_ledger_transactions (Transact-SQL)

Applies to: SQL Server 2022 (16.x) 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