Storing and deleting data recursively in SQL Server -


I am creating a blog component for a client's website and I'm having some problems with the data. There is a simple "content" table that holds content for blog entries. I am reusing this table for comments on blog entries because the fields are the same.

I have added a ParentID to the content table so that I can link the comments to their original content item. To ensure that I have not received zombie content items, I have added a trigger to remove any child content items when a content item is deleted:

  Remove from the content where However, when I remove content items that do not have any child content items, then I am getting the error from SQL Server (2008), in ParentID (select ID to be deleted)  

:

  Maximum of archived Trigger should set fire to the destroyed material once more (limit 32)  

than seeing a variety, function, trigger or nesting level, but if the material has no child, then it will Should not be called from? Does anyone know why I got this error?

TIA

Change the trigger to delete the existence of only rows

  DECLARE @ID int SELECT @ID = Remove the top ID from the content in ParentID (select the deleted ID) IF (not @ID) content where in ParentID (deleted ID Select) END  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -