Modifying an existing table’s schema with alter table

Adaptive Server 12.0 includes new syntax for alter table that allows you to add, drop, or modify a table’s columns. alter table...modify allows you to modify a column’s datatype, length, locking scheme, or default value. alter table also allows you to add, drop, or modify an IDENTITY column and to add a null or non-null column.

alter table includes the following syntax for modifying a table’s schema:

alter table table_name
[add column_name datatype [identity | null | 
	not null] [, column_name datatype [identity |null | not null]]]
[drop column_name [, column_name]
	[modify column_name {[data_type] 
	[[null] | [not null]]}
	[, column_name datatype [null | not null]]]

Where table_name is the table you are altering, and datatype is the datatype of the altered column. The following example changes the datatype of the type column in the titles table from char(12) to varchar(20) and makes it nullable:

alter table titles
modify type varchar(20) null