K3日志定时备份

 K3日志超过5万条以后,每次用户登陆后,系统都会提示日志太多。但是日志又不能随意删除,所以需要做个数据库定时任务,定时把日志转移到备份表。

declare @dt datetime;;

SELECT @dt = getdate();

Insert into t_log_history 
select [FDate]
      ,[FUserID]
      ,[FFunctionID]
      ,[FStatement]
      ,[FDescription]
      ,[FMachineName]
      ,[FIPAddress] from t_log where fdate<@dt;
DELETE FROM t_log WHERE fdate<@dt;

posted @ 2018-05-28 14:03  黄大神  阅读(516)  评论(0编辑  收藏  举报