Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with tables

Creating tables Next Page

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 on altering database object properties, see Setting properties for database objects.

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

Table alterations and view dependencies

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.

When you alter the schema of a table, the definition for the table in the database is updated. If there are dependent, non-materialized views, the database server automatically recompiles them after you perform the table alteration. If the database server cannot recompile a dependent non-materialized 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 Altering 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 Creating materialized views.

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.

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

Altering tables (Sybase Central)
Altering tables (SQL)