CREATE TABLE statement
CREATE TABLE statement
Function
Syntax
466
Use this statement to create a new table in the database and, optionally, to
create a table on a remote server.
CREATE [ GLOBAL TEMPORARY ] TABLE [ owner .] table-name
... ( { column-definition | table-constraint }, ... )
... [ { IN | ON } dbspace-name ]
... [ ON COMMIT { DELETE | PRESERVE } ROWS ]
[ AT location-string ]
column-definition :
column-name data-type [ NOT NULL ]
... [ DEFAULT default-value ] [ column-constraint ... ]
default-value :
AUTOINCREMENT
| GLOBAL AUTOINCREMENT [ ( partition-size ) ]
| ( constant-expression ) | global variable | NULL | number
| string | special-value | TIMESTAMP
special-value :
CURRENT { DATE | TIME | TIMESTAMP | USER | PUBLISHER }
| SQLCODE | SQLSTATE | LAST USER
column-constraint :
{ UNIQUE
| PRIMARY KEY
| REFERENCES table-name [( column-name )] [ actions ]
} [ WITH [ MAX | MAXIMUM ] HASH SIZE hash-size ]
| CHECK ( condition )
| COMPUTE ( expression )
table-constraint :
{ UNIQUE ( column-name , ... )
| PRIMARY KEY ( column-name , ... )
} [ WITH [ MAX | MAXIMUM ] HASH SIZE n ]
| CHECK ( condition ) | foreign-key-constraint
foreign-key-constraint :
[ NOT NULL ] FOREIGN KEY [ role-name ] [( column-name , ... )]
... REFERENCES table-name [( column-name , ... )]
... [ actions ] [ CHECK ON COMMIT ]
... [ WITH [ MAX | MAXIMUM ] HASH SIZE n ]
action :
ON { UPDATE | DELETE }
...{ CASCADE | SET NULL | SET DEFAULT | RESTRICT }
location-string :
remote-server-name .[ db-name ].[ owner ]. object-name
| remote-server-name ;[ db-name ];[ owner ]; object-name
Need help?
Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?
Questions and answers