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

SQL Anywhere 10.0.1 » UltraLite - Database Management and Reference » Working with UltraLite Databases » Working with UltraLite tables and columns

Adding a column to an UltraLite table Next Page

Altering UltraLite column definitions

You can change the structure of column definitions for a table by altering various column attributes, or even deleting columns entirely. The modified column definition must suit the requirements of any data already stored in the column. For example, you cannot alter a column to disallow NULL if the column already has a NULL entry.

You can use either Sybase Central or Interactive SQL to perform this task.

Sybase Central

In Sybase Central, you can perform these tasks while working with a selected table.

To alter an existing UltraLite column (Sybase Central)
  1. Connect to the UltraLite database.

  2. Open the Tables folder.

  3. In the Columns tab, make the necessary attribute changes.

  4. Choose File > Save Table when finished.

Interactive SQL

In Interactive SQL, you can perform these tasks with the ALTER TABLE statement.

To alter an existing UltraLite column (Interactive SQL)
  1. Connect to the UltraLite database.

  2. Execute an ALTER TABLE statement.

    Make changes carefully

    The following examples show how to change the structure of the database. In all these cases, the statement is immediately committed. So, once you make the change, any item referring to this table may no longer work.

    Examples    The following statement shortens the SkillDescription column from a maximum of 254 characters to a maximum of 80:

    ALTER TABLE Skills
    MODIFY SkillDescription CHAR( 80 )

    The following statement deletes the Classification column:

    ALTER TABLE Skills
    DROP Classification

    The following statement changes the name of the entire table:

    ALTER TABLE Skills
    RENAME Qualification
  3. See also