RENAME COLUMN statement
Use the RENAME COLUMN statement to change the name of a column. The RENAME COLUMN statement is an extension to the ANSI/ISO standard for SQL.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
new_column | Name that you declare here to replace old_column | Must be unique among column names in table. See also How Triggers Are Affected. | Identifier |
old_column | Column to rename | Must exist within table | Identifier |
owner | Owner of the table | Must be the owner of table | Owner name |
table | Table that contains old_column | Must be registered in the current database | Identifier |
Usage
You can rename a
column of a table if any of the following conditions are true:
- You own the table or have Alter privilege on the table.
- You have the DBA privilege on the database.
The column can be in a table object that the CREATE EXTERNAL TABLE statement defined.
Example
The
following example assigns the new name of c_num to the customer_num column
in the customer table:
RENAME COLUMN customer.customer_num TO c_num;