View Single Post

  #7 (permalink)  
Old 04-17-2007
subtenante
 
Posts: n/a
Default Re: Organisation tree - prevent deletion of parent organisation

On Tue, 17 Apr 2007 11:14:11 +0200, "Vojta" <ryvo@centrum.cz> wrote:


>ALTER TABLE MemberTree ADD CONSTRAINT C_MemberTree_1
>FOREIGN KEY (ParentId) REFERENCES MemberTree(Id) ON DELETE CASCADE; (*)


Yes.
The problem is in your ON DELETE CASCADE.
This means that if you delete a row, all its children will be erased
too.
So simply take it out of the definition, it should work fine.
Reply With Quote