Sybase Adaptive Server Anywhere Reference page 492

Table of Contents

Advertisement

CREATE TABLE statement
474
NOT NULL
Disallow NULL in the foreign key columns. A NULL
in a foreign key means that no row in the primary table corresponds
to this row in the foreign table.
role-name
The role name is the name of the foreign key. The
main function of the role name is to distinguish two foreign keys to
the same table. If no role name is specified, the role name is
assigned as follows:
1
If there is no foreign key with a role name the same as the table
name, the table name is assigned as the role name.
2
If the table name is already taken, the role name is the table
name concatenated with a zero-padded three-digit number
unique to the table.
The referential integrity action defines the action to be
action
taken to maintain foreign key relationships in the database.
Whenever a primary key value is changed or deleted from a
database table, there may be corresponding foreign key values in
other tables that should be modified in some way. You can specify
either an ON UPDATE clause, an ON DELETE clause, or both,
followed by one of the following actions:
CASCADE
When used with ON UPDATE, updates the
corresponding foreign keys to match the new primary key
value. When used with ON DELETE, deletes the rows from the
foreign table that match the deleted primary key.
Sets to NULL all the foreign key values that
SET NULL
correspond to the updated or deleted primary key.
SET DEFAULT
updated or deleted primary key value to values specified on the
DEFAULT clause of each foreign key column.
Generates an error if an attempt is made to update
RESTRICT
or delete a primary key value while there are corresponding
foreign keys elsewhere in the database. RESTRICT is the
default action.
CHECK ON COMMIT
overrides the WAIT_FOR_COMMIT database option, and causes
the database server to wait for a COMMIT before checking
RESTRICT actions on a foreign key. The CHECK ON COMMIT
clause does not delay CASCADE, SET NULL, or SET DEFAULT
actions.
Sets foreign key values that match the
The CHECK ON COMMIT clause

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?

Questions and answers

Table of Contents