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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Triggers

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-26 : 10:09:47
asprer writes "Hi everyone!

I am a rookie, and need your help. I've been looking into this site, and find this site as my resource guide. I am ready to post my first question. Here it is.

-I have two tables: 'Order details' and 'Product Sum'.
-The ProductSum table contains the following colums: Product_id, OrderedCount, and GrossRevenue. (NOTE: The 'ProductSum' is preloaded using the same columns from the 'Order Details'table. These columns are OrderID, ProductID, and UnitPrice.

Now, what I basically want to do is : Create an 'insert' trigger on the 'Order Detail' table that will do the following:

A. On insert in the 'Order Detail' table Update the OrderCOunt and GrossRevenue fields for the product being ordered -

OrderedCount = Current Ordered Count plus the new Quantity
GrossRevenue = Current GrossRevenue plus the new Quantity *
UnitPrice amount.

THis is it.

Thanks guys,
Romeo"
   

- Advertisement -