Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Posts
    1

    Angry Unanswered: on delete cascade on the same table - is it possible?

    Hi !
    as u should know this code doesn't work ..

    CREATE TABLE tempo (
    cid int,
    parent_id int,
    PRIMARY KEY (cid),
    FOREIGN KEY (parent_id) REFERENCES tempo ON DELETE CASCADE
    )


    any suggestion to achieve this ?
    thx!

  2. #2
    Join Date
    Feb 2003
    Location
    Auckland, NZ
    Posts
    150
    Create a trigger to delete all the records with the same criteria. When a record is deleted in that Table.

    This Code may help

    create trigger delcascadetrig
    on tempo
    for delete
    as
    delete parent_id
    from tempo, deleted
    where tempo.cid = deleted.cid

    Last edited by machado; 05-08-03 at 17:28.
    JJ Kennedy
    Double J IT Solutions
    www.doublejit.co.nz

    VB 6, VB.NET, ASP.NET, MS SQL Server, MySQL, MS Access

Posting Permissions

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