create trigger tri_test on a for update as
if exists(select * from b inner join inserted a on
x=a.x and y=a.y and w=a.w and q=a.q and d=a.d and t=a.t and u=a.u and o=a.o)
begin
update b set 列名=a.列名,............--等等
from inserted a where
x=a.x and y=a.y and w=a.w and q=a.q and d=a.d and t=a.t and u=a.u and o=a.o
end
create trigger tri_test on a for update as
if update (x) or update (y) or update (w) or update (q) or update (d) or update (t) or update (u)or update (o) begin
SET NOCOUNT ON
update b set x=a.x,y=a.y,w=a.w,q=a.q,t=a.t,u=a.u,o=a.o, from a,b
where a.*=b.*
end
“update b set med_jine=med_sprice*med_amount where a.*=b.*”这是什么意思
能不能按照
"我有两个数据表a,b
a表有列名x,y,w,q,d,t,u,o
b表同样列名
主要想实现,如果a表的一条或几条被改动,就在b表中更新同样的列名的数据。请帮忙写一下谢谢"这个写
create trigger tri_test on a for update as
if update (med_amount) or update (med_sprice) or update (med_jine) begin
SET NOCOUNT ON
update b set med_jine=med_sprice*med_amount where a.*=b.*
end