FirebirdSQL logo

The ADD Clause

With the ADD clause you can add a new column or a new table constraint.The syntax for defining the column and the syntax of defining the table constraint correspond with those described for [fblangref50-ddl-tbl-create] statement.

Effect on Version Count
  • Each time a new column is added, the metadata change counter is increased by one

  • Adding a new table constraint does not increase the metadata change counter

Caution
Points to Be Aware of
  1. Adding a column with a NOT NULL constraint without a DEFAULT value will fail if the table has existing rows.When adding a non-nullable column, it is recommended either to set a default value for it, or to create it as nullable, update the column in existing rows with a non-null value, and then add a NOT NULL constraint.

  2. When a new CHECK constraint is added, existing data is not tested for compliance.Prior testing of existing data against the new CHECK expression is recommended.

  3. Although adding an identity column is supported, this will only succeed if the table is empty.Adding an identity column will fail if the table has one or more rows.

The DROP Clause

The DROP colname clause deletes the specified column from the table.An attempt to drop a column will fail if anything references it.Consider the following items as sources of potential dependencies:

  • column or table constraints

  • indexes

  • stored procedures, functions and triggers

  • views

Effect on Version Count
  • Each time a column is dropped, the table’s metadata change counter is increased by one.