 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Alessandro Guest
|
Posted: Mon Apr 25, 2005 10:57 pm Post subject: SQL Server trigger |
|
|
Hi.
I have a table(Moviment) with the follow struct:
MovStock, int
MovProduct, int
MovDateMov, smalldatetime
MovIsn, int (this is order that moviment in this MovDateMov)
MovValue, numeric
MovAverage, numeric
I need write a trigger to when a insert a record this trigger calc the
average. Onother trigger that when i delete a record calc the average from
record deleted until end moviment of the stock / product.
How can i do this?
Thanks
Alessandro
|
|
| Back to top |
|
 |
Patrick Guest
|
Posted: Tue Apr 26, 2005 1:14 pm Post subject: Re: SQL Server trigger |
|
|
| Quote: | MovValue, numeric
MovAverage, numeric
I need write a trigger to when a insert a record this trigger calc the
average. Onother trigger that when i delete a record calc the average from
record deleted until end moviment of the stock / product.
Why not calc the average when you retrieve the data? |
| Quote: | How can i do this?
See CREATE TRIGGER in MS-SQL BOL. You would derive the average and update |
the rows.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|