Altering tables

This section describes how to alter the structure or column definitions of a table. For example, you can add columns, change various column attributes, or drop columns entirely.

You can perform table alteration tasks on the SQL tab in the right pane of Sybase Central. In Interactive SQL, you can perform them using the ALTER TABLE statement.

For information about altering database object properties, see Set properties for database objects.

For information about granting and revoking table permissions, see Granting permissions on tables, and Revoking user permissions and authorities.

Table alterations and view dependencies

Before altering a table, you may want to determine whether there are views dependent on a table, using the sa_dependent_views system procedure. See sa_dependent_views system procedure.

If you are altering the schema of a table with dependent views, there may be additional steps to make, as noted in the following sections.

  • Dependent regular views   When you alter the schema of a table, the definition for the table in the database is updated. If there are dependent regular views, the database server automatically recompiles them after you perform the table alteration. If the database server cannot recompile a dependent regular view after making a schema change to a table, it is likely because the change you made invalidated the view definition. In this case, you must correct the view definition. See Alter regular views.

  • Dependent materialized views   If there are dependent materialized views, you must disable them before making the table alteration, and then re-enable them after making the table alteration. If you cannot re-enable a dependent materialized view after making a schema change to a table, it is likely because the change you made invalidated the materialized view definition. In this case, you must drop the materialized view and then create it again with a valid definition, or make suitable alterations to the underlying table before trying to re-enable the materialized view. See Create materialized views.

For an overview of how altering database objects affects view dependencies, see View dependencies.


Alter tables (Sybase Central)
Alter tables (SQL)