adding multiple constraint relationship in Access
I need to add a multiple-constraint relationship between two tables in my app. The DDL for Access says that it should look something like:
ALTER TABLE tbl_name ADD CONSTRAINT multi-field-index
However, I can see no definition of what multi-field-index is. Have I missed something somewhere?
Sean
Hi,
Here's a piece of code on how to use constraints in access:
CREATE TABLE Orders (OrderId INTEGER PRIMARY KEY, CustId INTEGER, OrderNotes NCHAR VARYING (255), CONSTRAINT FKOrdersCustId FOREIGN KEY (CustId) REFERENCES Customers ON UPDATE SET NULL ON DELETE SET NULL
As you can see the value of constraints goes this kind of declaration:
CONSTRAINT name
{PRIMARY KEY (primary1[, primary2 [, ...]]) |
UNIQUE (unique1[, unique2 [, ...]]) |
NOT NULL (notnull1[, notnull2 [, ...]]) |
FOREIGN KEY [NO INDEX] (ref1[, ref2 [, ...]]) REFERENCES foreigntable [(foreignfield1 [, foreignfield2 [, ...]])]
[ON UPDATE CASCADE | SET NULL]
[ON DELETE CASCADE | SET NULL]}
cheers,
Paul June A. Domag