Altering a Table

Restriction: This topic applies to Windows environments only.

The Alter Table dialog box lets you add, change, or delete a table's columns, as well as to add or change an existing table's indexes, primary keys, foreign keys, synonyms, and aliases.

If you are running against an XDB Server (local or multi-user), just about any part of a table specification can be altered, even if the table already contains data. You can rename the table or its columns, change column data types, change the ordering of the columns, and add or drop columns.

Note:

If you are running against DB2, there are limits on the changes you can make to a table because the DB2 ALTER TABLE statement is not as comprehensive as the XDB Server ALTER TABLE statement. When connected to DB2 via XDB Link, only those functions that are supported on DB2 (such as adding columns) are enabled on the Alter Table dialog box.

To alter a table:

  1. Click the Alter command from the Table menu.
    Note:


    Catalog Browser button
    From the Catalog Browser dialog box, click the Table tab and choose a table; then click the Alter button.

    SQLWizard displays the Open dialog box.

  2. Choose a table and click OK. SQLWizard displays the Alter Table dialog box.
  3. Modify the table specification as you wish. Making changes is similar to the initial entry of table specifications when creating a table.
    Note:

    If you wish to change the data type of an existing field, be sure that the new data type is compatible with the old data type. For example, you would not be allowed to change a date field to a decimal field. Other changes may be possible, but not desirable, such as changing an integer field to a character field.

  4. Click OK to alter the table.
  5. Click OK to confirm the table alterations.