sql存储过程的应用

sql存储过程的应用

ID:6770445

大小:29.00 KB

页数:4页

时间:2018-01-25

sql存储过程的应用_第1页
sql存储过程的应用_第2页
sql存储过程的应用_第3页
sql存储过程的应用_第4页
资源描述:

《sql存储过程的应用》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、SQL存储过程的应用SQL存储过程的应用——ATM银行转账系统(二)开户存储过程usebankDBgoselect*fromuserInfoselect*fromcardInfoselect*fromtransInfocreateprocp_openAccount@customerNamechar(8),@cardIDvarchar(30),@PIDchar(18),@telephonechar(13),@openMoneymoney,@savingTypechar(8),@userAddressvarchar(50)=''asif(@openMo

2、ney>=1)begininsertintouserInfo(customerName,PID,telephone,userAddress)values(@customerName,@PID,@telephone,@userAddress)declare@cur_customerIDintselect@cur_customerID=customerIDfromuserInfowherePID=@PIDinsertintocardInfo(cardID,savingType,openMoney,balance,customerID)values(@c

3、ardID,@savingType,@openMoney,@openMoney,@cur_customerID)endelseprint'开户金额不能小于1元'go填充数据usebankDBgoinsertintouserInfo(customerName,PID,telephone,userAddress)',123456789012345,'010-67898978','北京海淀')insertintouserInfo(customerName,PID,telephone,userAddress)',321245678912345678,'02

4、7-67898978','武汉江岸区')insertintouserInfo(customerName,PID,telephone,userAddress)',221245678912345672,'021-67898978','上海浦东区')insertintouserInfo(customerName,PID,telephone,userAddress)',521245678912345675,'13178910771','合肥肥西区')values('values('values('values('张李王赵三四五六goinsertintoca

5、rdInfo(cardID,savingType,openMoney,balance,pass,customerID)values('1010357612345678','活期',1000,1000,123123,1)insertintocardInfo(cardID,savingType,openMoney,balance,pass,customerID)values('1010357612121134','定期',1,1,321321,2)insertintocardInfo(cardID,savingType,openMoney,balanc

6、e,customerID)values('1010357612562235','定活两便',50,50,3)insertintocardInfo(cardID,savingType,openMoney,balance,customerID)values('1010357613583221','活期',500,500,4)goinsertintotransInfo(transDate,transType,cardID,transMoney)values(getdate(),'支取','1010357612345678',900)updatecardI

7、nfosetbalance=balance-900wherecustomerID=1insertintotransInfo(transDate,transType,cardID,transMoney)values(getdate(),'存取','1010357612121134',5000)updatecardInfosetbalance=balance+5000wherecustomerID=2updatecardInfosetIsReportLoss=1wherecardID='1010357612121134'updatecardInfose

8、tIsReportLoss=1wherecardID='1010357612562235'select*fromuserI

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。