I am looking to set up a trigger that will do some addition(the code below) on two columns if stage_1 or stage_2 is update.
Also is it possible to run the trigger ever 5 min instead of on every update. Thanks In advance for any help.
update monte_carlo_2013 set total = stage_1 + stage_2
I have had a look around the net at trigger and come up with this, which dose not work but am i going in the right direction
CREATE TRIGGER update_stage_1
ON monte_carlo_2013
AFTER INSERT
AS
BEGIN
update monte_carlo_2013 set total_after_1 = (stage_1 + penalty_after_1) WHERE car_num IN (SELECT car_num FROM INSERTED)
END$$