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. In the left pane, double-click Tables.

  3. Double-click a table.

  4. Click the Columns tab and alter the column attributes.

  5. From the File menu, choose Save Table.

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.

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

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;
See also