Use the same syntax to add a column with a user-defined datatype as with a system-defined datatype. For example, to add a column to the authors table of pubs2 using the usertype datatype:
alter table titles add newcolumn usertype not null
The NULL or NOT NULL default you specify takes precedence over the default specified by the user-defined datatype. That is, if you add a column and specify NOT NULL as the default, the new column has a default of NOT NULL even if the user-defined datatype specifies NULL. If you do not specify NULL or NOT NULL, the default specified by the user-defined datatype is used.
You must supply a default clause when you add columns that are not null, unless the user-defined datatype already has a default bound to it.
If the user-defined datatype specifies IDENTITY column properties (precision and scale), the column is added as an IDENTITY column.
Copyright © 2005. Sybase Inc. All rights reserved. |