• First, why have the hierarchy in two tables? It's more usual to have one table and a parent ID that refers back to the same table.

    Second, try having one trigger that crawls the whole hierarchy and deletes it all in one command. A recursive CTE that does a hierarchy crawl should allow this.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon