Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trigger of child table
Message
 
 
À
05/08/2007 12:17:29
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01246025
Message ID:
01246026
Vues:
21
Maybe I'm missing something bu8t why can't you check for master table record existence before performing update in the child table trigger?

>I have tables master - PurchaseInvoices and child - PurchaseInvoiceDetails. I have trigger in PurchaseInvoiceDetails that would update stock qty based on Location code stored in master table - PurchaseInvoices upon INSERT/UPDATE/DELETE.
>
>I also set table RI to have cascade delete. I faced problem that, when I delete record in master table, it would cascade delete child table. Trigger in child table fired and try to update stock qty. However, in this case, trigger unable to locate master table record anymore.
>
>How to overcome this? I can't move my stock update code to other place since I got to update stock if any changes happen to child table.
>
>Please advice.
>
>Thank you
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform