ADD COLUMN¶
ADD COLUMN
can be used to add columns to an existing table.
Permissions¶
The role must have the DDL
permission at the database or table level.
Syntax¶
alter_table_add_column_statement ::=
ALTER TABLE [schema_name.]table_name { ADD COLUMN column_def [, ...] }
;
table_name ::= identifier
schema_name ::= identifier
column_def :: = { column_name type_name [ default ] [ column_constraint ] }
column_name ::= identifier
column_constraint ::=
{ NOT NULL | NULL }
default ::=
DEFAULT default_value
Parameters¶
Parameter |
Description |
---|---|
|
The schema name for the table. Defaults to |
|
The table name to apply the change to. |
|
A comma separated list of ADD COLUMN commands |
|
A column definition. A minimal column definition includes a name identifier and a datatype. Other column constraints and default values can be added optionally. |
Note
When adding a new column to an existing table, a default (or null constraint) has to be specified, even if the table is empty.
A new column added to the table can not contain an IDENTITY or be of the TEXT type.