To modify an existing column, use:
alter table table_name modify column_name datatype [null | not null] [null | not null] [, column_name...]
Where:
table_name is the table that contains the column you are modifying.
column_name is the column you are modifying.
data_type is the datatype to which you are modifying the column.
You can modify any number of columns in a single alter table statement.
For example, this command 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
WARNING! You may have objects (stored procedures, triggers, and so on) that depend on a column having a particular datatype. Before you modify a column, make sure that any objects that reference it can run successfully after the modification. Use sp_depends to determine a table’s dependent objects.
Copyright © 2005. Sybase Inc. All rights reserved. |