Regarding triggers

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

Dear Sir,

Since procedures and triggers are almost the same why is'nt a query plan created for a trigger? I have a table with two columns price and priceid. Could u please help me in writing a query that gives a running total of the price.It should be something like this priceid price total 1 100 100 2 200 300 3 100 400 Any help would be greatly appreciated ThanQ John Jem Kurian

-- Anonymous, July 14, 1999

Answers

John,

Here is how you might write such a query against the titles table in the pubs database:

select t1.title_id, t1.title, t1.price, "total" = sum (t2.price) from titles t1, titles t2 where t1.price <> null and t2.price <> null and t2.title_id <= t1.title_id group by t1.title_id, t1.title, t1.price

Hope this helps,

Eric

-- Anonymous, July 14, 1999


Moderation questions? read the FAQ