银行转账存储过程
USE [BankInfor] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[Transfer](@inAccount int,@outAccount int,@amount float) as declare @totalDeposit float; begin select @totalDeposit=total from Account where AccountNum=@outAccount; if @totalDeposit is null begin rollback; print'转出账户不存在或账户中没有存款' return; end if @totalDeposit<@amount begin rollback; print'余额不足,不能操作' return; end update Account set total=total-@amount where AccountNum=@outAccount; update Account set total=total+@amount where AccountNum=@inAccount; print'转账成功!' commit; end;
查看更多关于实用的银行转账存储过程和流水号生成存储过程的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did32729