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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need Help with Triggers

Author  Topic 

tishri
Yak Posting Veteran

95 Posts

Posted - 2006-12-15 : 22:09:38
Hey guys I need help with triggers.

This is my table diagram.


[Accounts Table] [Payments Table]
Account_ID (Primary) Relate to => Account_ID
Balance as Money Date Paid [PaymentDetails Table]
PaymentsDetail_ID Relate to ==> PaymentsDetail_ID
Description
Amount_Paid


All tables have recursive update and delete.

when delete action is invoked in [paymentdetails table] i can successfully update the balance in accounts table but when delete action is invoked in [payments table] i cannot update balance in accounts table.

Can you suggest a trigger query so that i can update the balance in accounts table.




TCC

madhuotp
Yak Posting Veteran

78 Posts

Posted - 2006-12-15 : 23:59:55
hI,

In such scenario what you can do is create a sp with all business rule to be applied in All the three tables and pass TableName and Action(Insert/Update/Delete) as input parameter. Each table will have a FOr Insert,Update,Delete trigger which will call this SP with Tablename and Action .

Madhu
Go to Top of Page
   

- Advertisement -