Viewing 2 posts - 1 through 3 (of 3 total)
Hi, using your help I come up with the following solution for the trigger:
IF (@action = 'INSERT')
BEGIN
-- update existing balances
UPDATE dbo.AccountBalance
SET Balance = Balance + i.Debit - i.Credit
FROM AccountBalance b,...
August 3, 2012 at 6:43 am
#1521351
Thank you for your help, here is my script:
Stored Procedure:
ALTER PROC [dbo].[usp_UpdateAccountBalance] @AccountId INT, @Amount MONEY
AS
DECLARE @Count INT;
SELECT @Count = COUNT(*) FROM dbo.AccountBalance
WHERE AccountId = @AccountId;
IF (@Count = 0)
INSERT INTO...
August 3, 2012 at 2:49 am
#1521280