CREATE PROCEDURE [dbo].[up_SetMonitorCommand] @log_type int ,@world_ID int ,@server_type int ,@GM_ID nvarchar(16) ,@command int ,@server_code int 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_CreateMonitorCommandTable @createtime SET @updatesql ='insert into MonitorCommand_Log_'+ @year+'_'+@month +'(log_type, world_id, channel_ID, executer_ID, command, target, date) values (' + '''' +convert(nvarchar, @log_type) + '''' + ',' + '''' +convert(nvarchar, @world_id) + '''' + ',' + '''' +convert(nvarchar, @server_type) + '''' + ',' + '''' +@GM_ID + '''' + ',' + '''' +convert(nvarchar, @command) + '''' + ',' + '''' +convert(nvarchar, @server_code) + '''' + ',' + '''' +convert(nvarchar, @createtime, 109) + '''' + ')' EXEC(@updatesql) if(@@error <> 0) begin rollback return end commit