ALTER COLUMN
Function
This syntax modifies the current column properties, including column comments and null constraints. Currently, it does not support modifying column types or column positions.
Precautions
- Modifying column types is currently not supported.
- Modifying the order of existing columns is currently not supported.
- Adding columns in a specified order is currently not supported.
Syntax
ALTER TABLE Table name ALTER
[COLUMN] col_name
[COMMENT] col_comment
Parameter Description
| Parameter | Description |
|---|---|
| tableName | Table name. |
| col_name | Name of the column to be altered. |
| column_type | Type of the target column. |
| col_comment | Column comment. |
| column_name | New position to place the target column. For example, AFTER column_name indicates that the target column is placed after column_name. |
Required Permissions
- SQL permissions
| Permission Description |
|---|
| ALTER permission on a table |
- Fine-grained permission: dli:table:alter
- Metadata services provided by LakeFormation. Refer to the LakeFormation documentation for details on permission configuration.
Example
- Altering other attributes
ALTER TABLE table1 ALTER COLUMN col_a DROP NOT NULL ALTER TABLE table1 ALTER COLUMN col_a COMMENT 'new comment'
Response
You can run the DESCRIBE command to view the modified column.