Create the trigger famount_updatess
On B
For update
As
The BEGIN
Declare @ famount float
Declare @ fquty float
Select @ famount=famount from inserted the where I i.f id in (select fid the from inserted)
SELECT @ fquty=SUM (isnull (fquty, 0)) FROM inserted the where I
Fparentid IN (SELECT fparentid FROM inserted group by fparentid) group by fparentid
If the UPDATE (famount)
Update the set B b. price=@ famount/nullif (b. quty, 0) from B join inserted I on b. id IN (select fid the from inserted)
UPDATE A SET a.f quty=@ fquty from A join inserted on a.f id=I i.f parentid where a.f id in (select fparentid from inserted)
END
This how to change
CodePudding user response:
??????????