This statement is an extension to the ANSI/ISO standard for SQL.
>>-RENAME COLUMN--+--------+--table--.--old_column--------------> '-owner.-' >--TO--new_column----------------------------------------------><
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, p. Identifier |
old_column | Column to rename | Must exist within table | Identifier, p. Identifier |
owner | Owner of the table | Must be the owner of table | Owner Name, p. Owner Name |
table | Table that contains old_column | Must exist in the current database | Identifier, p. Identifier |
You can rename a column of a table if any of the following conditions are true:
In Extended Parallel Server, you cannot rename the columns of a fragmented table if the table is fragmented by range. For more information, see RANGE Method Clause (XPS).
If you rename a column that appears in a view, the text of the view definition in the sysviews system catalog table is updated to reflect the new column name. If you rename a column that appears in a check constraint, the text of the check constraint in the syschecks system catalog table is updated to reflect the new column name.
If you rename a column that appears within the definition a trigger, it is replaced with the new name only in the following instances:
When the trigger executes, if the database server encounters a column name that no longer exists in the table, an error is returned.
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
Related statements: ALTER TABLE, CREATE TABLE , CREATE TRIGGER, CREATE VIEW , and RENAME TABLE