|
create table temp (ID int, product ID int, time datetime, v1 int, v2 int, v3 int, v4 int, sums int)
create trigger auto_update on temp
for insert
as
update a set a. time = getdate (), a.sums = a.v1 + a.v2 + a.v3 + a.v4 from temp a, inserted b where a. product ID = b. product ID
insert temp (Product ID) values (2001)
select * from temp |
|