I'm using a Trigger :
ALTER TRIGGER trans_trig
for UPDATE, INSERT
SET balance = (select sum(deposit) - sum(payment) FROM Transactions t2 WHERE t2.TID <= Transactions.TID and t2.AccID = Transactions.AccID)
FROM inserted i
WHERE Transactions.AccID = i.AccID
and transactions.TID >= i.TID
The trigger works just fine except that when i insert a new record i get this error message :
"-2147467259 Key column information is insufficient or incorrect. Too many rows were affected by update"
does anyone have any ideas why and how i can get rid of it ?