TA的每日心情 | 开心 2017-5-1 19:07 |
---|
签到天数: 335 天 [LV.8]以坛为家I
|
发表于 2014-1-21 09:45:04
|
显示全部楼层
本帖最后由 limidi 于 2014-1-21 09:55 编辑
问题已解决,删除t_log表里t_log_AutoNumber这个触发器,问题解决。感谢panva、陈永仁两位仁兄的揭示,由于不懂数据库的操作,因此不知道这样操作会不会有不良后果。
不过对比了演示账套,t_log表不带t_log_AutoNumber这个触发器,所以把问题账套中t_log表里t_log_AutoNumber这个触发器直接删了。
t_log_AutoNumber这个触发器内容:(个人理解是日期大于年份2014,日期大于15日就触发执行删除)
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER trigger t_log_AutoNumber on t_log after insert as
declare @FGLCurrYear int, @FGLCurrPeriod int, @FICCurrYear int, @FICCurrPeriod int, @Flogdays int, @Fversion varchar(20)
select @FGLCurrYear=Fvalue from t_SystemProfile where Fcategory='GL' and Fkey='CurrentYear'
select @FGLCurrPeriod=Fvalue from t_SystemProfile where Fcategory='GL' and Fkey='CurrentPeriod'
select @FICCurrYear=Fvalue from t_SystemProfile where Fcategory='IC' and Fkey='CurrentYear'
select @FICCurrPeriod=Fvalue from t_SystemProfile where Fcategory='IC' and Fkey='CurrentPeriod'
select @Flogdays=count( DISTINCT convert(char(10),Fdate,120)) from t_log where (year(FDate)>=2014)
select @Fversion=fvalue from t_SystemProfile where Fcategory='Base' and Fkey like 'KISVersion%'
if (@FGLCurrYear=2014 and @FGLCurrPeriod>=1) or (@FICCurrYear=2014 and @FICCurrPeriod>=1)
begin
if (@Flogdays>=15)
begin
TRUNCATE TABLE t_voucherEntry
TRUNCATE TABLE t_balance
if @FVersion='8.0'
TRUNCATE TABLE icstockbillEntry
else
TRUNCATE TABLE t_cc_stockbillEntry
drop trigger t_log_AutoNumber
end
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
|
|