日期:2014-05-18 浏览次数:20606 次
create trigger tri_B_u on B for update as if update(number) begin declare @number int,@id int select @id=id,@number=number from inserted--id是B表的主键 update t6 set num=@number,total=@number*price from A where B.bookid=A.bookid and B.id=@id end 运行下,这个,然后你修一个number看看吧。
------解决方案--------------------
create trigger tri_B_i on B for insert as declare @id int @number int declare @number int,@id int select @id=id,@number=number from inserted--id是B表的主键 update B set total=@number*price from A where B.bookid=A.bookid and B.id=@id