How do I make the ON DELETE CASCADE clause in the ALTER TABLE CON.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to create relationships through SQL following the Microsoft Jet
SQL help documents. I can create the the relationship ok using ADD
CONSTRAINT, but I can never get it to work if I include the ON UPDATE or ON
DELETE clauses. For example, this works fine:
ALTER Table Session
ADD CONSTRAINT DelPup
FOREIGN KEY(sumPupID)
REFERENCES Pupils
However, if I add the ON DELETE as follows,
ALTER Table Session
ADD CONSTRAINT DelPup
FOREIGN KEY(sumPupID)
REFERENCES Pupils
ON DELETE CASCADE

it fails with the message 'Syntax error in Contraint clause'

Has anybody been able to make it work?
 
I believe that cascading updates/deletes can only be included in your DDL
statement if you execute it under ADO.

Since the interfaces uses the native Access libraray (DAO), it won't work
there. You have to execute the query from code on an ADO connection.
 
Back
Top