Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger in table A to update row(s) in Table B?
Message
From
26/07/2005 10:30:49
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Trigger in table A to update row(s) in Table B?
Miscellaneous
Thread ID:
01035925
Message ID:
01035925
Views:
66
Assume:

Table A, containing "Master" records

Fields KeyField, SumAmount (being the SUM(Amount) from table B for KeyField 'K')

Table B, containing "Child" records, fields KeyField, Amount

On insert, update, delete in B I'd like to update the SumAmount in table A,
but not, of course for the entire table, just for the ones with the KeyField 'K'

I've tried calling a stored procedure from the trigger, but I have to somehow pass the Keyfield value of the inserted/updated record(s) from table B to the sp, and I have not been able to figure out how to do that.

So:

1) Can I do this with a trigger?

2) If yes, how?

TIA
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Next
Reply
Map
View

Click here to load this message in the networking platform