Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Azure Data Explorer
Changes the name of existing table columns.
Permissions
You must have at least Table Admin permissions to run this command.
Syntax
.rename column [ DatabaseName.]TableName.CurrentColumnName to NewColumnName
.rename columns NewColumnName = [ DatabaseName.]TableName.CurrentColumnName , ...
Note
.rename columns only supports swapping the names of exactly two existing columns.
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| DatabaseName | string |
The name of the database that contains the table with the column to rename. If not provided, the current context database is used. | |
| TableName | string |
✔️ | The name of the table containing the column to rename. |
| CurrentColumnName | string |
✔️ | The name of the column to rename. |
| NewColumnName | string |
✔️ | The new name for the column. The name must follow the identifier naming rules. |
Example
The following command swaps the names of the TimeGenerated_archive column and the TimeGenerated column.
.rename columns TimeGenerated_archive = myDB.sampleData.TimeGenerated, TimeGenerated = myDB.sampleData.TimeGenerated_archive