.alter column command

Applies to: ✅ Microsoft FabricAzure Data Explorer

Alters the data type of an existing table column.

Warning

When altering the data type of a column, any preexisting data in that column will return a null value in future queries. After using .alter column, that data cannot be recovered, even by using another command to alter the column type back to a previous value. For information on how to preserve preexisting data, see Change column type without data loss.

Permissions

You must have at least Table Admin permissions to run this command.

Syntax

.alter column [DatabaseName .] TableName . ColumnName type = ColumnNewType

Learn more about syntax conventions.

Parameters

Name Type Required Description
DatabaseName string The name of the database that contains the table.
TableName string ✔️ The name of the table that contains the column to alter.
ColumnName string ✔️ The name of the column to alter.
ColumnNewType string ✔️ The new data type for the column.

Example

.alter column ['Table'].['ColumnX'] type=string