Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger
Message
From
10/04/2002 15:49:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00643372
Message ID:
00643433
Views:
6
Go to VFP (or TaxRI) referential integrity, create the self-relation, and select "cascade" for the delete part. That's all! VFP (or TaxRI) will create all the required code.

HTH, Hilmar.

>Hi guys!
>
>I have this situation: I have self-related table and want to delete a record X and all the records below it.
>Example:
>
>these are the records in my table:
>
>Employee - Boss
>******** ********
>Bill .Null.
>Joe Bill
>Mark Joe
>John Mark
>Peter Joe
>Paul John
>
>So, I have this logical structure:
>
>Bill
> |__Joe
>     |__Mark
>     |   |__John
>     |       |__Paul
>     |__Peter
>
>I want that, when I delete Joe, Mark, John, Paul and Peter get deleted too!
>
>I thought about 2 ways of doing that: the first one is a recursive function, where I would first "walk" and after delete (the deletion order would be paul, John, Mark, Peter and Paul). The other way (which i don't know if may work) is to create a trigger for the delete event on the table, but with this one I am not getting the idea.
>
>Please, which one is better? Can you explain and give an example?
>
>TIA,
>
>Alonso
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform