Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Delete Stored Procedure

Author  Topic 

burnseymufc
Starting Member

4 Posts

Posted - 2008-10-03 : 06:39:20
I am trying to write a stored procedure that will delete from a top level downwards. Everything is in one table called Modules. I can add a Module to the table and a sub module to the table. A sub module can be linked to a module and a sub module can be linked to a sub module and so on. These are how they are linked:

ID Name Parent

9 Histopathology Null --Module, top level
40 Cervical 9 --Sub Module
41 Cancer 9 --Sub Module
900 Liver 40 --Sub Module
901 Virtual Slides 40 --Sub Module
904 Cytopathology 41 --Sub Module
1006 Neurology 41 --Sub Module

Each sub module's is related to its parent by the 'parent' and 'id'.

How can I go about deleting all of these using a stored procedure if I only have the id of the top module, to one with an id of 9?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-03 : 06:45:23
Duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=111883

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -