存储过程

来源:互联网 发布:南昌广州seo外包 编辑:程序博客网 时间:2024/06/05 22:52
USE [机房重构]GO/****** Object:  StoredProcedure [dbo].[proc_Account]    Script Date: 04/23/2017 21:08:54 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: <Author,,Name>-- Create date: <Create Date,,>-- Description:<Description,,>-- =============================================ALTER PROCEDURE [dbo].[proc_Account] -- Add the parameters for the stored procedure here@UserID char(10),@RemainCash int,@RechargeCash int,@CancelCash int,@AllCash int,@ADate date,@Count intASdeclare @False char(10)BEGINSET NOCOUNT ON;    set @False='未结账'    --注册清况    if @Count=1    begin--exec('select CardNo,StudentNo,DDate,Time,IsCheck from Card_Info where Ischeck=@False and userID='+@UserID+'')--select CardNo,StudentNo,DDate,Time,IsCheck from Card_Info where Ischeck='未结账' and userID='+@UserID+'exec('select CardNo,StudentNo,DDate,Time,IsCheck from Card_Info where userID='+@UserID+'')end--充值情况 if @Count=2 begin--select CardNo,RechargeCash,RDate,Time,IsCheck from ReCharge_Info where IsCheck=@False and userID='+@UserID+'--exec('select CardNo,RechargeCash,RDate,Time,IsCheck from ReCharge_Info where userID='+@UserID+'+IsCheck =“未结账”')exec('select CardNo,RechargeCash,RDate,Time,IsCheck from ReCharge_Info where userID='+@UserID+'') end --退卡情况 if @Count=3 begin--select CardNo,CancelCash,EDate,Time,IsCheck from CancelCard_Info where Ischeck='未结账' and userID='+@UserID+'exec('select CardNo,CancelCash,EDate,Time,IsCheck from CancelCard_Info where userID='+@UserID+'')end--更新表情况 if @Count=5 beginupdate Card_Info set IsCheck='已结账' where userID=@UserID and IsCheck=@False update ReCharge_Info set IsCheck='已结账' where userID=@UserID and IsCheck=@False update CancelCard_Info set IsCheck='已结账' where userID=@UserID and IsCheck=@False insert into Check_Info (RemainCash,RechargeCash,CancelCash,AllCash,ADate,UserID )values(@RemainCash,@RechargeCash,@CancelCash,@AllCash,@ADate,@UserID )exec('select * from Check_Info ') end    END

0 0
原创粉丝点击