Xbasic
SQL::ReferentialUpdateRule Enumerated Type
Description
This is an enumerated type is used to describe desired behavior when an update or a delete occurs for a table that has references to it from one or more other tables. The value is specified as an update or delete rule for a specific reference (foreign key relationship) and is a constraint on the referencing table. The values in the following list are supported:
- Value
- Description
- Restrict
0
- Cascade
1
- SetNull
2
- SetDefault
3
Dim Index as SQL::IndexInfo Index.ReferencedTable = MyReferencedTable ? Index.DeleteRule = SetNull Index.UpdateRule = Cascade
The resulting create table statements. Note the italicized ON clauses in the second table.
CREATE TABLE MyReferencedTable
(
Key1 VARCHAR NOT NULL,
?
PRIMARY KEY (Key1)
)
CREATE TABLE MyReferencingTable
(
Key1 VARCHAR(5) NOT NULL,
Key2 VARCHAR(5) NOT NULL,
?
PRIMARY KEY (Key1, Key2),
FOREIGN KEY (Key1) REFERENCES MyReferencedTable
ON DELETE SET NULL
ON UPDATE CASCADE
)Limitations
Internal use only.
See Also