You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/relational-databases/security/ledger/ledger-how-to-updatable-ledger-tables.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ This article shows you how to create an [updatable ledger table](ledger-updatabl
19
19
20
20
## Prerequisites
21
21
22
-
-[SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms) or [Azure Data Studio](/sql/azure-data-studio/download-azure-data-studio).
22
+
-[SQL Server Management Studio](../../../ssms/download-sql-server-management-studio-ssms.md) or [Azure Data Studio](../../../azure-data-studio/download-azure-data-studio.md).
23
23
24
24
## Create an updatable ledger table
25
25
@@ -33,9 +33,9 @@ We'll create an account balance table with the following schema.
33
33
| Balance | decimal (10,2) | Account balance |
34
34
35
35
> [!IMPORTANT]
36
-
> Creating updatable ledger tables requires the **ENABLE LEDGER** permission. For more information on permissions related to ledger tables, see [Permissions](/sql/relational-databases/security/permissions-database-engine#asdbpermissions).
36
+
> Creating updatable ledger tables requires the **ENABLE LEDGER** permission. For more information on permissions related to ledger tables, see [Permissions](../permissions-database-engine.md#asdbpermissions).
37
37
38
-
1. Use [SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms) or [Azure Data Studio](/sql/azure-data-studio/download-azure-data-studio) to create a new schema and table called `[Account].[Balance]`.
38
+
1. Use [SQL Server Management Studio](../../../ssms/download-sql-server-management-studio-ssms.md) or [Azure Data Studio](../../../azure-data-studio/download-azure-data-studio.md) to create a new schema and table called `[Account].[Balance]`.
39
39
40
40
```sql
41
41
CREATE SCHEMA [Account];
@@ -91,7 +91,7 @@ We'll create an account balance table with the following schema.
91
91
(4, 'Michaels', 'Mary', 200);
92
92
```
93
93
94
-
1. View the `[Account].[Balance]` updatable ledger table, and specify the [GENERATED ALWAYS](/sql/t-sql/statements/create-table-transact-sql#generate-always-columns) columns added to the table.
94
+
1. View the `[Account].[Balance]` updatable ledger table, and specify the [GENERATED ALWAYS](../../../t-sql/statements/create-table-transact-sql.md#generate-always-columns) columns added to the table.
95
95
96
96
```sql
97
97
SELECT [CustomerID]
@@ -147,4 +147,4 @@ We'll create an account balance table with the following schema.
Copy file name to clipboardExpand all lines: docs/relational-databases/security/ledger/ledger-limits.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Consider the following when working with ledger.
26
26
- A [ledger database](ledger-database-ledger.md), a database with the ledger property set to on, can't be converted to a regular database, with the ledger property set to off.
27
27
- Automatic generation and storage of database digests is currently available in Azure SQL Database, but not supported on SQL Server.
28
28
- Automated digest management with ledger tables by using [Azure Storage immutable blobs](/azure/storage/blobs/immutable-storage-overview) doesn't offer the ability for users to use [locally redundant storage (LRS)](/azure/storage/common/storage-redundancy#locally-redundant-storage) accounts.
29
-
- When a ledger database is created, all new tables created by default (without specifying the `APPEND_ONLY = ON` clause) in the database will be [updatable ledger tables](ledger-updatable-ledger-tables.md). To create [append-only ledger tables](ledger-append-only-ledger-tables.md), use the `APPEND_ONLY = ON` clause in the [CREATE TABLE (Transact-SQL)](/sql/t-sql/statements/create-table-transact-sql) statements.
29
+
- When a ledger database is created, all new tables created by default (without specifying the `APPEND_ONLY = ON` clause) in the database will be [updatable ledger tables](ledger-updatable-ledger-tables.md). To create [append-only ledger tables](ledger-append-only-ledger-tables.md), use the `APPEND_ONLY = ON` clause in the [CREATE TABLE (Transact-SQL)](../../../t-sql/statements/create-table-transact-sql.md) statements.
30
30
- A transaction can update up to 200 ledger tables.
31
31
32
32
## Ledger table considerations and limitations
@@ -35,7 +35,7 @@ Consider the following when working with ledger.
35
35
- After a ledger table is created, it can't be reverted to a table that isn't a ledger table.
36
36
- Deleting older data in [append-only ledger tables](ledger-append-only-ledger-tables.md) or the history table of [updatable ledger tables](ledger-updatable-ledger-tables.md) isn't supported.
37
37
-`TRUNCATE TABLE` isn't supported.
38
-
- When an [updatable ledger table](ledger-updatable-ledger-tables.md) is created, it adds four [GENERATED ALWAYS](/sql/t-sql/statements/create-table-transact-sql#generate-always-columns) columns to the ledger table. An [append-only ledger table](ledger-append-only-ledger-tables.md) adds two columns to the ledger table. These new columns count against the maximum supported number of columns in Azure SQL Database (1,024).
38
+
- When an [updatable ledger table](ledger-updatable-ledger-tables.md) is created, it adds four [GENERATED ALWAYS](../../../t-sql/statements/create-table-transact-sql.md#generate-always-columns) columns to the ledger table. An [append-only ledger table](ledger-append-only-ledger-tables.md) adds two columns to the ledger table. These new columns count against the maximum supported number of columns in Azure SQL Database (1,024).
39
39
- In-memory tables aren't supported.
40
40
- Sparse column sets aren't supported.
41
41
- SWITCH IN/OUT partition isn't supported.
@@ -56,7 +56,7 @@ Consider the following when working with ledger.
56
56
57
57
### Temporal table limitations
58
58
59
-
Updatable ledger tables are based on the technology of [temporal tables](/sql/relational-databases/tables/temporal-tables) and inherits most of the [limitations](/sql/relational-databases/tables/temporal-table-considerations-and-limitations) but not all of them. Below is a list of limitations that is inherited from temporal tables.
59
+
Updatable ledger tables are based on the technology of [temporal tables](../../tables/temporal-tables.md) and inherits most of the [limitations](../../tables/temporal-table-considerations-and-limitations.md) but not all of them. Below is a list of limitations that is inherited from temporal tables.
60
60
61
61
- If the name of a history table is specified during history table creation, you must specify the schema and table name and also the name of the ledger view.
62
62
- By default, the history table is PAGE compressed.
@@ -67,7 +67,7 @@ Updatable ledger tables are based on the technology of [temporal tables](/sql/re
67
67
- The history table must be created in the same database as the current table. Temporal querying over Linked Server isn't supported.
68
68
- The history table can't have constraints (Primary Key, Foreign Key, table, or column constraints).
69
69
- Online option (`WITH (ONLINE = ON`) has no effect on `ALTER TABLE ALTER COLUMN` in case of system-versioned temporal table. `ALTER COLUMN` isn't performed as online regardless of which value was specified for the `ONLINE` option.
70
-
-`INSERT` and `UPDATE` statements can't reference the [GENERATED ALWAYS](/sql/t-sql/statements/create-table-transact-sql#generate-always-columns) columns. Attempts to insert values directly into these columns will be blocked.
70
+
-`INSERT` and `UPDATE` statements can't reference the [GENERATED ALWAYS](../../../t-sql/statements/create-table-transact-sql.md#generate-always-columns) columns. Attempts to insert values directly into these columns will be blocked.
71
71
-`UPDATETEXT` and `WRITETEXT` aren't supported.
72
72
- Triggers on the history table aren't allowed.
73
73
- Usage of replication technologies is limited:
@@ -89,11 +89,11 @@ Updatable ledger tables are based on the technology of [temporal tables](/sql/re
89
89
90
90
### Adding columns
91
91
92
-
Adding nullable columns is supported. Ledger is designed to ignore NULL values when computing the hash of a row version. Based on that, when a nullable column is added, ledger will modify the schema of the ledger and history tables to include the new column, however, this doesn't impact the hashes of existing rows. Adding columns in ledger tables is captured in [sys.ledger_column_history](/sql/relational-databases/system-catalog-views/sys-ledger-column-history-transact-sql).
92
+
Adding nullable columns is supported. Ledger is designed to ignore NULL values when computing the hash of a row version. Based on that, when a nullable column is added, ledger will modify the schema of the ledger and history tables to include the new column, however, this doesn't impact the hashes of existing rows. Adding columns in ledger tables is captured in [sys.ledger_column_history](../../system-catalog-views/sys-ledger-column-history-transact-sql.md).
93
93
94
94
### Dropping columns and tables
95
95
96
-
Normally, dropping a column or table completely erases the underlying data from the database and is fundamentally incompatible with the ledger functionality that requires data to be immutable. Instead of deleting the data, ledger simply renames the objects being dropped so that they're logically removed from the user schema, but physically remain in the database. Any dropped columns are also hidden from the ledger table schema, so that they're invisible to the user application. However, the data of such dropped objects remains available for the ledger verification process, and allows users to inspect any historical data through the corresponding ledger views. Dropping columns in ledger tables is captured in [sys.ledger_column_history](/sql/relational-databases/system-catalog-views/sys-ledger-column-history-transact-sql). Dropping a ledger table is captured in [sys.ledger_table_history](/sql/relational-databases/system-catalog-views/sys-ledger-table-history-transact-sql). Dropping ledger tables and its dependent objects are marked as dropped in system catalog views and renamed:
96
+
Normally, dropping a column or table completely erases the underlying data from the database and is fundamentally incompatible with the ledger functionality that requires data to be immutable. Instead of deleting the data, ledger simply renames the objects being dropped so that they're logically removed from the user schema, but physically remain in the database. Any dropped columns are also hidden from the ledger table schema, so that they're invisible to the user application. However, the data of such dropped objects remains available for the ledger verification process, and allows users to inspect any historical data through the corresponding ledger views. Dropping columns in ledger tables is captured in [sys.ledger_column_history](../../system-catalog-views/sys-ledger-column-history-transact-sql.md). Dropping a ledger table is captured in [sys.ledger_table_history](../../system-catalog-views/sys-ledger-table-history-transact-sql.md). Dropping ledger tables and its dependent objects are marked as dropped in system catalog views and renamed:
97
97
98
98
- Dropped ledger tables are marked as dropped by setting `is_dropped_ledger_table` in **sys.tables** and renamed using the following format: `MSSQL_DroppedLedgerTable_<dropped_ledger_table_name>_<GUID>`.
99
99
- Dropped history tables for updatable ledger tables are renamed using the following format: `MSSQL_DroppedLedgerHistory_<dropped_history_table_name>_<GUID>`.
@@ -114,4 +114,4 @@ However, any operations that might affect the format of existing data, such as c
Copy file name to clipboardExpand all lines: docs/relational-databases/security/ledger/ledger-updatable-ledger-tables.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,20 +21,20 @@ Both updatable ledger tables and [temporal tables](../../tables/temporal-tables.
21
21
22
22
:::image type="content" source="media/ledger/ledger-table-architecture.png" alt-text="Diagram that shows ledger table architecture.":::
23
23
24
-
You can create an updatable ledger table by specifying the `LEDGER = ON` argument in your [CREATE DATABASE (Transact-SQL)](/sql/t-sql/statements/create-database-transact-sql) statement.
24
+
You can create an updatable ledger table by specifying the `LEDGER = ON` argument in your [CREATE DATABASE (Transact-SQL)](../../../t-sql/statements/create-database-transact-sql.md) statement.
25
25
> [!TIP]
26
26
> `LEDGER = ON` is optional when creating updatable ledger tables in a ledger database. By default, each table is an updatable ledger table in a ledger database.
27
27
28
-
For information on options available when you specify the `LEDGER` argument in your T-SQL statement, see [CREATE TABLE (Transact-SQL)](/sql/t-sql/statements/create-table-transact-sql).
28
+
For information on options available when you specify the `LEDGER` argument in your T-SQL statement, see [CREATE TABLE (Transact-SQL)](../../../t-sql/statements/create-table-transact-sql.md).
29
29
30
30
> [!IMPORTANT]
31
31
> After a ledger table is created, it can't be reverted to a table that isn't a ledger table. As a result, an attacker can't temporarily remove ledger capabilities on a ledger table, make changes, and then reenable ledger functionality.
32
32
33
33
### Updatable ledger table schema
34
34
35
-
An updatable ledger table needs to have the following [GENERATED ALWAYS](/sql/t-sql/statements/create-table-transact-sql#generate-always-columns) columns that contain metadata noting which transactions made changes to the table and the order of operations by which rows were updated by the transaction. This data is useful for forensics purposes in understanding how data was inserted over time.
35
+
An updatable ledger table needs to have the following [GENERATED ALWAYS](../../../t-sql/statements/create-table-transact-sql.md#generate-always-columns) columns that contain metadata noting which transactions made changes to the table and the order of operations by which rows were updated by the transaction. This data is useful for forensics purposes in understanding how data was inserted over time.
36
36
37
-
If you don't specify the required `GENERATED ALWAYS` columns of the ledger table and ledger history table in the [CREATE TABLE (Transact-SQL)](/sql/t-sql/statements/create-table-transact-sql?view=azuresqldb-current&preserve-view=true) statement, the system automatically adds the columns and uses the following default names. For more information, see examples in [Creating an updatable ledger table](/sql/t-sql/statements/create-table-transact-sql?view=azuresqldb-current&preserve-view=true#x-creating-a-updatable-ledger-table).
37
+
If you don't specify the required `GENERATED ALWAYS` columns of the ledger table and ledger history table in the [CREATE TABLE (Transact-SQL)](../../../t-sql/statements/create-table-transact-sql.md?preserve-view=true&view=azuresqldb-current) statement, the system automatically adds the columns and uses the following default names. For more information, see examples in [Creating an updatable ledger table](../../../t-sql/statements/create-table-transact-sql.md?preserve-view=true&view=azuresqldb-current#y-creating-an-updatable-ledger-table).
38
38
39
39
| Default column name | Data type | Description |
40
40
| --- | --- | --- |
@@ -57,12 +57,12 @@ For example, if you want to track transaction history for a banking scenario, th
57
57
58
58
For an example of using the ledger view, see [Create and use updatable ledger tables](ledger-how-to-updatable-ledger-tables.md).
59
59
60
-
The ledger view's schema mirrors the columns defined in the updatable ledger and history table, but the [GENERATED ALWAYS](/sql/t-sql/statements/create-table-transact-sql#generate-always-columns) columns are different than those of the updatable ledger and history tables.
60
+
The ledger view's schema mirrors the columns defined in the updatable ledger and history table, but the [GENERATED ALWAYS](../../../t-sql/statements/create-table-transact-sql.md#generate-always-columns) columns are different than those of the updatable ledger and history tables.
61
61
62
62
### Ledger view schema
63
63
64
64
> [!NOTE]
65
-
> The ledger view column names can be customized when you create the table by using the `<ledger_view_option>` parameter with the [CREATE TABLE (Transact-SQL)](/sql/t-sql/statements/create-table-transact-sql?view=azuresqldb-current&preserve-view=true) statement. For more information, see [ledger view options](/sql/t-sql/statements/create-table-transact-sql?view=azuresqldb-current&preserve-view=true#ledger-view-options) and the corresponding examples in [CREATE TABLE (Transact-SQL)](/sql/t-sql/statements/create-table-transact-sql?view=azuresqldb-current&preserve-view=true).
65
+
> The ledger view column names can be customized when you create the table by using the `<ledger_view_option>` parameter with the [CREATE TABLE (Transact-SQL)](../../../t-sql/statements/create-table-transact-sql.md?preserve-view=true&view=azuresqldb-current) statement. For more information, see [ledger view options](../../../t-sql/statements/create-table-transact-sql.md?preserve-view=true&view=azuresqldb-current#ledger-view-option) and the corresponding examples in [CREATE TABLE (Transact-SQL)](../../../t-sql/statements/create-table-transact-sql.md?preserve-view=true&view=azuresqldb-current).
0 commit comments