Alter tables (SQL)

You can alter tables in Interactive SQL using the ALTER TABLE statement. If you use a clause other than ADD FOREIGN KEY with the ALTER TABLE statement on a table with dependent materialized views, the ALTER TABLE statement fails. For all other clauses, you must disable the dependent materialized views and then re-enable them when your changes are complete. See View dependencies.

Use the sa_dependent_views system procedure to determine if there are dependent materialized views. See sa_dependent_views system procedure.

 To alter an existing table (SQL)
  1. Connect to the database as a user with DBA authority.

  2. If you are performing a schema-altering operation on tables with dependent materialized views, and use a clause other than ADD FOREIGN KEY with the ALTER TABLE statement, use the ALTER MATERIALIZED VIEW ... DISABLE statement to disable each dependent materialized view. You do not need to disable dependent regular views.

  3. Execute an ALTER TABLE statement to perform the table alteration.

    The definition for the table in the database is updated.

  4. If you disabled any materialized views, use the ALTER MATERIALIZED VIEW ... ENABLE statement to re-enable them.

 Examples
 See also