日期:2014-05-18 浏览次数:20473 次
if objectproperty(object_id('B_UPD'),'IsTrigger')=1 drop trigger B_UPD go create trigger B_UPD on B for update as if update(POINT) begin update A set GPA=case when t.CREDIT=0 then 0 else t.PC/t.CREDIT end from ( select B.SNO,PC=sum(B.POINT*C.CREDIT), CREDIT=sum(C.CREDIT) from C,B,inserted i where C.CNO=B.CNO and B.SNO=i.SNO group by B.SNO )t where A.SNO=t.SNO end go