This article provides information on configuring a ledger database using the Azure portal, T-SQL, PowerShell, or the Azure CLI for Azure SQL Database. For information on creating a ledger database in SQL Server 2022 (16.x) or Azure SQL Managed Instance, use the switch at the top of this page.
Enabling the ledger functionality at the database level will make all tables in this database updatable ledger tables. This option cannot be changed after the database is created. Creating a table with the option LEDGER = OFF will throw an error message.
CREATE DATABASE Database01
(
EDITION = 'GeneralPurpose',
SERVICE_OBJECTIVE='GP_Gen5_2',
MAXSIZE = 2 GB
)
WITH LEDGER = ON;
GO
Enable ledger database using PowerShell
Create a single ledger database with the New-AzSqlDatabase cmdlet.
The below example creates a serverless database. The parameter -EnableLedger will create the ledger database.
Note: Make sure you modify the parameters ServerName and DatabaseName
Create a ledger database with the az sql db create command. The following command creates a serverless database with ledger enabled. Note: Make sure you modify the parameters resource-group, server and name
This article provides information on configuring a ledger database using T-SQL, PowerShell, or the Azure CLI for Azure SQL Managed Instance. For information on creating a ledger database in SQL Server 2022 (16.x) or Azure SQL Database, use the switch at the top of this page.
Enabling the ledger functionality at the database level will make all tables in this database updatable ledger tables. This option cannot be changed after the database is created. Creating a table with the option LEDGER = OFF will throw an error message.
Create a single ledger database with the New-AzSqlInstanceDatabase cmdlet.
The following example creates a ledger database on a specified instance. The parameter -EnableLedger creates the ledger database.
Make sure you modify the parameters ResourceGroupName, InstanceName and Name.
Create a ledger database with the az sql midb create command. The below example creates a ledger database on a specified instance. Make sure you modify the parameters resource-group, managed-instance and name.
This article provides information on creating a ledger database by using T-SQL in SQL Server 2022 (16.x). For information on creating a ledger database in Azure SQL Database or Azure SQL Managed Instance, use the switch at the top of this page.
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.