server-re/decomp/schema/RustyHearts_Log/procs/up_SetGold.sql

75 lines
2.2 KiB
Transact-SQL

CREATE PROCEDURE [dbo].[up_SetGold]
@log_type smallint,
@world_id int,
@auth_id [uniqueidentifier],
@bcust_id nvarchar(50) = NULL,
@character_id [uniqueidentifier],
@character_name nvarchar(50),
@Otherauth_id [uniqueidentifier],
@Otherbcust_id nvarchar(50) = NULL,
@Othercharacter_id [uniqueidentifier],
@Othercharacter_name nvarchar(50),
@Gold_Prev int,
@Gold_Change int,
@Gold_After int,
@record_time datetime
as
set nocount on
declare @createtime datetime
set @createtime = getdate()
declare @year varchar(50)
declare @month varchar(50)
set @year = convert(varchar, datepart(yy,@createtime))
set @month = convert(varchar, datepart(mm,@createtime))
set xact_abort on
begin tran
declare @updatesql nvarchar(2500)
declare @char_auth_id nvarchar(50)
declare @char_character_id nvarchar(50)
declare @char_other_auth_id nvarchar(50)
declare @char_other_character_id nvarchar(50)
-- Login_Log ??? ??
exec Local_CreateMoneyTable @createtime
set @char_auth_id = @auth_id
set @char_character_id = @character_id
set @char_other_auth_id = @Otherauth_id
set @char_other_character_id = @Othercharacter_id
SET @updatesql ='insert into Money_Log_'+ @year+'_'
+@month+'(log_type, world_id, auth_id, bcust_id, character_id, character_name, other_auth_id, other_bcust_id, other_character_id, other_character_name, before_money, after_money, change_money, entry_date )
values ('
+ '''' +convert(nvarchar, @log_type) + '''' + ','
+ '''' +convert(nvarchar, @world_id) + '''' + ','
+ '''' +@char_auth_id + '''' + ','
+ '''' +@bcust_id+ '''' + ','
+ '''' +@char_character_id+ '''' + ','
+ '''' +@character_name+ '''' + ','
+ '''' +@char_other_auth_id+ '''' + ','
+ '''' +@Otherbcust_id+ '''' + ','
+ '''' +@char_other_character_id+ '''' + ','
+ '''' +@Othercharacter_name+ '''' + ','
+ '''' +convert(nvarchar, @Gold_Prev)+ '''' +','
+ '''' +convert(nvarchar, @Gold_After)+ '''' +','
+ '''' +convert(nvarchar, @Gold_Change)+ '''' +','
+ '''' +convert(nvarchar, @record_time, 109)+ '''' + ')'
EXEC(@updatesql)
if(@@error <> 0)
begin
rollback
return
end
commit