Using a language command, alter table adds new columns to an existing table.
alter table [database.[owner].]table_name
add column_name datatype {null | not null}[{, next_column}...]
is the name of the table to be changed.
is the name of a column to be added.
is the datatype of the column. Use only system datatypes, except bit. Certain datatypes expect a length, n, in parentheses:
datatype(n)
specifies a null value if a user does not provide a value during an insertion and no default exists (for null), or that a user must provide a non-null value if no default exists (for not null).
indicates that you can include additional column definitions separated by commas, using the same syntax described for a column definition.
The following example adds the manager_name column to the publishers table. For each existing row in the table, a null value is assigned to the new column.
alter table publishers
add manager_name varchar(40) null
ASE/CIS sends the alter table command to DirectConnect as a language event.
The following are not supported:
add constraint
drop constraint
replace column name
partition | unpartition
Transformation adds parentheses when the add column option includes more than one column.
Copyright © 2005. Sybase Inc. All rights reserved. |