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

72 lines
1.6 KiB
Transact-SQL

CREATE PROCEDURE [dbo].[up_SetGMInquiry]
@inquiry_id uniqueidentifier,
@auth_id uniqueidentifier,
@char_id uniqueidentifier,
@world_id int,
@type tinyint,
@character_name nvarchar(20),
@bcust_id nvarchar(20),
@memo nvarchar(255)
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(1500)
declare @char_inquiry_id nvarchar(50)
declare @char_auth_id nvarchar(50)
declare @char_char_id nvarchar(50)
set @char_inquiry_id = @inquiry_id
set @char_auth_id = @auth_id
set @char_char_id = @char_id
exec Local_CreateGMInquiryTable @createtime
SET @updatesql ='insert into GMInquiry_'+ @year+'_'
+@month+'( inquiry_id
,auth_id
,char_id
,world_id
,type
,character_name
,state
,online
,bcust_id
,memo
,date )
values ('
+ '''' +@char_inquiry_id + '''' + ','
+ '''' +@char_auth_id + '''' + ','
+ '''' +@char_char_id + '''' + ','
+ '''' +convert(nvarchar, @world_id) + '''' + ','
+ '''' +convert(nvarchar, @type) + '''' + ','
+ '''' +@character_name + '''' + ','
+ '''' +convert(nvarchar, 1) + '''' + ','
+ '''' +convert(nvarchar, 1) + '''' + ','
+ '''' +@bcust_id + '''' + ','
+ '''' +@memo + '''' + ','
+ '''' +convert(nvarchar, @createtime, 109)+ '''' + ')'
EXEC(@updatesql)
if(@@error <> 0)
begin
rollback
return
end
commit