Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger of child table
Message
 
 
To
05/08/2007 12:17:29
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01246025
Message ID:
01246026
Views:
20
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform