ALTER TRIGGER [dbo].[AP] ON [dbo].[TransactionHistory]
FOR INSERT,UPDATE
AS 
   DECLARE @id varchar(10)
   DECLARE @Turnover money
   DECLARE @NumberOfTransactions money
   DECLARE @AverageTransactionPrice MONEY
   DECLARE @Fee MONEY
   DECLARE @StampDuty MONEY
   DECLARE @OccurAmount MONEY
   DECLARE @count INT
   SELECT @id=T.id FROM TransactionHistory T INNER JOIN INSERTED I ON T.id=I.id
   
   SELECT @Turnover=Turnover,@NumberOfTransactions=NumberOfTransactions,@AverageTransactionPrice=AverageTransactionPrice
   FROM TransactionDate WHERE id=(SELECT TID FROM TransactionHistory WHERE id=@id)
   
   SET @Fee=ROUND(@Turnover*0.0006,2)
   SET @StampDuty= ROUND(@Turnover*0.001,2)
   
   UPDATE TransactionHistory SET Fee=@Fee,StampDuty=@StampDuty,
   OccurAmount= ROUND(@Turnover-(@Fee+@StampDuty+OtherMiscellaneous),2) WHERE id=@id
   IF(@count=0)
   BEGIN
   INSERT INTO dbo.FundsDetails(OccurAmount)VALUES(@OccurAmount)
   END我想将TransactionHistory 表的OccurAmount字段在更新的时候,插入到另一张表中. 另一张表设了一个FID
INSERT INTO dbo.FundsDetails(OccurAmount)VALUES(@OccurAmount)
好像没用...
哪里错了哪里没写好,帮忙看下