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

50 lines
1.2 KiB
Transact-SQL

CREATE PROCEDURE [dbo].[up_SetMonitorNotice]
@log_type int
,@world_id int
,@target int
,@notice_type tinyint
,@notice_cycle tinyint
,@notice nvarchar(255)
,@gm_ID nvarchar(16)
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)
exec Local_CreateMonitorNoticeTable @createtime
SET @updatesql ='insert into MonitorNotice_Log_'+ @year+'_'+@month
+'(log_type, world_id, target, notice_type, notice_cycle, notice, gm_ID, date)
values ('
+ '''' +convert(nvarchar, @log_type) + '''' + ','
+ '''' +convert(nvarchar, @world_id) + '''' + ','
+ '''' +convert(nvarchar, @target) + '''' + ','
+ '''' +convert(nvarchar, @notice_type) + '''' + ','
+ '''' +convert(nvarchar, @notice_cycle) + '''' + ','
+ '''' +@notice + '''' + ','
+ '''' +@gm_ID + '''' + ','
+ '''' +convert(nvarchar, @createtime, 109) + '''' + ')'
EXEC(@updatesql)
if(@@error <> 0)
begin
rollback
return
end
commit