最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
一个四用户信息同步更新的存储过程
时间:2022-07-02 09:33:42 编辑:袖梨 来源:一聚教程网
不实用,之所以写,一为领导的要求,另外也熟悉下写代码,代码多写点也没什么坏处,并且写了之后发现临时表还挺容易用的,数据量小的时候,并显不出临时表速度不行的问题.
代码如下:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
/*
Name:游戏中四人数据同时更新
Designed By :whbo
Designed At :2005-10-12
Modified By :
Modified At :
Memo:
*/
ALTER PROC [PrMoney_UpdateCash2]
@chvModeName varchar(16),
@chvSourceName varchar(64),
@chvRemark varchar(128),
@intUserID1 int,
@intUserID2 int,
@intUserID3 int,
@intUserID4 int,
@intWantedAmount1 int,
@intWantedAmount2 int,
@intWantedAmount3 int,
@intWantedAmount4 int,
@chvIPAddress1 varchar(15),
@chvIPAddress2 varchar(15),
@chvIPAddress3 varchar(15),
@chvIPAddress4 varchar(15),
@inyLog tinyint
as
set nocount on
set xact_abort on
Declare @intCashAmount1 int,@intCashAmount2 int,@intCashAmount3 int,@intCashAmount4 int
Declare @FRate float,@FTemp float
Declare @bNeedReCalc bit --0:不用重算 ;1:需要重算
set @FRate=1.0
set @FTemp=1.0
set @bNeedReCalc=0
Declare @FTemp1 float,@FTemp2 float,@FTemp3 float,@FTemp4 float
--这里要注意,更新用户现金取数据库中的数据,跟游戏服务器能否保持一致
--取得用户现金
select @intCashAmount1=[Amount] from [dbo].[Money] where [UserID]=@intUserID1
select @intCashAmount2=[Amount] from [dbo].[Money] where [UserID]=@intUserID2
select @intCashAmount3=[Amount] from [dbo].[Money] where [UserID]=@intUserID3
select @intCashAmount4=[Amount] from [dbo].[Money] where [UserID]=@intUserID4
Create Table #Temp1(TTemp float)
if @intCashAmount1 @intWantedAmount1<0
begin
set @FTemp=-@intCashAmount1/@intWantedAmount1
insert into #temp1 values(@FTemp)
end
if @intCashAmount2 @intWantedAmount2<0
begin
set @FTemp=-@intCashAmount2/@intWantedAmount2
insert into #temp1 values(@FTemp)
代码如下:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
/*
Name:游戏中四人数据同时更新
Designed By :whbo
Designed At :2005-10-12
Modified By :
Modified At :
Memo:
*/
ALTER PROC [PrMoney_UpdateCash2]
@chvModeName varchar(16),
@chvSourceName varchar(64),
@chvRemark varchar(128),
@intUserID1 int,
@intUserID2 int,
@intUserID3 int,
@intUserID4 int,
@intWantedAmount1 int,
@intWantedAmount2 int,
@intWantedAmount3 int,
@intWantedAmount4 int,
@chvIPAddress1 varchar(15),
@chvIPAddress2 varchar(15),
@chvIPAddress3 varchar(15),
@chvIPAddress4 varchar(15),
@inyLog tinyint
as
set nocount on
set xact_abort on
Declare @intCashAmount1 int,@intCashAmount2 int,@intCashAmount3 int,@intCashAmount4 int
Declare @FRate float,@FTemp float
Declare @bNeedReCalc bit --0:不用重算 ;1:需要重算
set @FRate=1.0
set @FTemp=1.0
set @bNeedReCalc=0
Declare @FTemp1 float,@FTemp2 float,@FTemp3 float,@FTemp4 float
--这里要注意,更新用户现金取数据库中的数据,跟游戏服务器能否保持一致
--取得用户现金
select @intCashAmount1=[Amount] from [dbo].[Money] where [UserID]=@intUserID1
select @intCashAmount2=[Amount] from [dbo].[Money] where [UserID]=@intUserID2
select @intCashAmount3=[Amount] from [dbo].[Money] where [UserID]=@intUserID3
select @intCashAmount4=[Amount] from [dbo].[Money] where [UserID]=@intUserID4
Create Table #Temp1(TTemp float)
if @intCashAmount1 @intWantedAmount1<0
begin
set @FTemp=-@intCashAmount1/@intWantedAmount1
insert into #temp1 values(@FTemp)
end
if @intCashAmount2 @intWantedAmount2<0
begin
set @FTemp=-@intCashAmount2/@intWantedAmount2
insert into #temp1 values(@FTemp)
相关文章
- 人们熟悉的寄居蟹属于以下哪种分类 神奇海洋11月21日答案 11-21
- 第五人格11.22共研服有什么更新 11月22日共研服更新内容介绍 11-21
- 原神恰斯卡怎么培养 11-21
- 无期迷途四星装束是谁 11-21
- 王者荣耀帝丹高中校服怎么获得 11-21
- 光遇姆明季后续版本怎么玩 11-21