Altering a Table

From InterBase
Jump to: navigation, search

Go Up to Altering Metadata


ALTER TABLE enables the following changes to an existing table:

  • Adding new column definitions
  • Adding new table constraints
  • Dropping existing column definitions
  • Dropping existing table constraints
  • Changing column definitions by dropping existing definitions, and adding new ones
  • Changing existing table constraints by dropping existing definitions, and adding new ones
  • Modifying column names and data types

The simple syntax of ALTER TABLE is as follows:

EXEC SQL
ALTER TABLE name {ADD colname <datatype> [NOT NULL]
| ALTER [COLUMN] simple_column_name alter_rel_field

 | DROP colname | ADD CONSTRAINT constraintname tableconstraint
| DROP CONSTRAINT constraintname};
Note: For information about adding, dropping, and modifying constraints at the table level, see the Data Definition Guide.

For the complete syntax of ALTER TABLE, see the Language Reference Guide.

Topics