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.
Author |
Topic |
tishri
Yak Posting Veteran
95 Posts |
Posted - 2006-12-15 : 22:10:30
|
Hey guys I need help with triggers.This is my table diagram.[Accounts Table] [Payments Table]Account_ID (Primary) Relate to => Account_IDBalance 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. TCCTCC |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-12-15 : 23:58:58
|
Duplicate Post:[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76488[/url]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
tishri
Yak Posting Veteran
95 Posts |
Posted - 2006-12-16 : 19:07:41
|
Can you help me guys build the trigger for UPDATE,DELETE,INSERT in [payments table] and [paymentsdetail table] so that it will update the [balance] in [accounts table] ...ON INSERTbalance = balance + amount_paid ON DELETEbalance = balance - amount_paidneed help really.....TCC |
 |
|
madhuotp
Yak Posting Veteran
78 Posts |
Posted - 2006-12-17 : 13:05:29
|
can u post u r trigger script. in delete trigger u should refer Deleted table.Madhu |
 |
|
|
|
|