Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2008
    Posts
    14

    Unanswered: "ON DELETE CASCADE" fails in constraint clause

    I have a table named Customers with the field CustID as primary key.

    I then issued this DDL query to create another table - Orders:


    CREATE TABLE Orders (OrderId INTEGER, CustId INTEGER, Qty Integer, CONSTRAINT FKOrdersCustId FOREIGN KEY (CustId) REFERENCES Customers ON DELETE CASCADE

    When I execute the query a "Syntax error in CONSTRAINT clause" is returned and when i click ok, the DELETE clause is highlighted.

    I am using MS-Access 2007.

    The same error is trigered when I use the On UPDATE clause. The UPDATE clause is highlighted.

    Many thanks everybody with help on this.

    Vie
    @Abuja

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    ... references customers (<referencing field>) ON ...

    ?
    George
    Home | Blog

  3. #3
    Join Date
    Jul 2008
    Posts
    14
    thanks GVee.

    I beleive you mean explicitly including the <referencing field> as in

    "CREATE TABLE Orders (OrderId INTEGER, CustId INTEGER, OrderNotes varCHAR (255), CONSTRAINT FKOrdersCustId FOREIGN KEY (CustId) REFERENCES Customers (CustID) ON DELETE CASCADE)"

    I did that and have done it again and the system still is flagging the DELETE clause.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •