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.
| Author |
Topic |
|
kfitch
Starting Member
5 Posts |
Posted - 2001-06-05 : 11:59:39
|
| Hi, I'm trying to perfrom a recursive delete and I can't seem to get anything to work. I've tried triggers and stored procedures but nothing does it right. My database consists of 2 tables. The table1 contains data with each row having an int identity.The table2 relates records in table1 to each other in a parent/child relationship using their identities. So:table1ID Name-- --------1 Bob2 Mary3 Johntable2Parent Child------ -----1 22 3From this we see that Mary is a child of Bob, and John is a child of Mary.I want to be able to delete a row in table1, and then recursively delete all children of that item. I don't know how many levels the relationships go so this must be recursive. Any ideas? (Assume children can have only one parent and there are no cyclical associations of parents and children. The data I am storing represents a hierarchical tree of arbitrary depth.) |
|
|
|
|
|