Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trigger
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Trigger
Divers
Thread ID:
00643372
Message ID:
00643372
Vues:
36
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
Like Frank said: "I did it... MY WAY!"
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform