Ledger database vs ledger tables
Published Sep 19 2023 04:45 AM 2,373 Views

There is sometimes a misconception about the usage of a ledger database and ledger tables. In this blog post, I will explain the main difference and how they work together to provide tamper-evidence capabilities for your data.





A ledger database is a database that has the ledger property set to on, WITH LEDGER = ON. This means that all tables created in the database are updatable ledger tables by default unless you specify the APPEND_ONLY = ON clause to create append-only ledger tables. Note that a ledger database can only be configured at creation time. Once created, a ledger database cannot be converted to a regular non-ledger database. Ledger databases are often used for applications that require high integrity, auditability, and compliance, such as financial systems, supply chain management, or identity management. Have a look at our documentation on how to create a ledger database.


Does this mean that you NEED to create a ledger database before you can use the ledger functionality? Absolutely not! The ledger feature is available in every Azure SQL Database, Azure SQL Managed Instance and SQL Server 2022 database. You only need to create an updatable or append-only ledger table to guarantee data integrity at a table level.


To summarize, ledger databases provide an easy solution for applications that require the integrity of all data to be protected for the entire lifetime of the database. A ledger database can only contain ledger tables. Creating regular tables (that are not ledger tables) is not supported. If you need integrity at table level, just create an updatable or append-only ledger table in your regular database. There’s no need to “switch ledger on at the database level”.




Version history
Last update:
‎Sep 20 2023 12:34 AM
Updated by: