informix
Informix Guide to SQL: Syntax
SQL Statements

RENAME COLUMN

Use the RENAME COLUMN statement to change the name of a column.

Syntax

Element Purpose Restrictions Syntax
new_column New name to be assigned to the column If you rename a column that appears within a trigger definition, the new column name replaces the old column name in the trigger definition only if certain conditions are met. For more information on this restriction, see How Triggers Are Affected. Identifier, p. 4-205
old_column Current name of the column you want to rename The column must exist within the table. Identifier, p. 4-205
table Name of the table in which the column exists The table must exist. Database Object Name, p. 4-50

Usage

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.

How Views and Check Constraints Are Affected

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.

How Triggers Are Affected

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.

Example of RENAME COLUMN

The following example assigns the new name of c_num to the customer_num column in the customer table:

Related Information

Related statements: ALTER TABLE, CREATE TABLE, and RENAME TABLE


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved