![]() |
|
Use the RENAME COLUMN statement to change the name of a column.
You can rename a column of a table if any of the following conditions are true:
You cannot rename the columns of a fragmented table if the table is fragmented by range. For more information on tables fragmented by range, see RANGE Method Clause.
If you rename a column that appears in a view, the text of the view 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 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, it returns an error.
The following example assigns the new name of c_num to the customer_num column in the customer table:
Related statements: ALTER TABLE, CREATE TABLE, and RENAME TABLE