Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR ALTER PROC usp_DepositMoney (@accountId INT, @depositAmount DECIMAL(15, 4))
- AS
- BEGIN TRANSACTION
- UPDATE Accounts
- SET Balance += @depositAmount
- WHERE Id = @accountId
- IF (@@ROWCOUNT <> 1)
- BEGIN
- ROLLBACK;
- RAISERROR ('Invalid account!', 16, 1);
- RETURN;
- END
- COMMIT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement