你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
.alter table retention policy command
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer
Changes the table's retention policy. The retention policy controls the mechanism that automatically removes data from tables or materialized views. It is used to remove data whose relevance is age-based. The retention policy can be configured for a specific table or materialized view, or for an entire database. The policy then applies to all tables in the database that don't override it.
Permissions
You must have at least Table Admin permissions to run this command.
Syntax
.alter
table
TableName policy
retention
PolicyObject
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
TableName | string |
✔️ | The name of the table. |
PolicyObject | string |
✔️ | A serialized policy object. For more information, see retention policy. |
Example
Sets a retention policy with a 10 day soft-delete period, and enable data recoverability:
.alter table MySourceTable policy retention
```
{
"SoftDeletePeriod": "10.00:00:00",
"Recoverability": "Enabled"
}
```