清除历史数据
客户需要清除以前年度数据或者新建账套,金蝶历史数据清除工具和结转新账套操作后,
会有很多未核销的入库单、出库单还存在,很不方便。
特意写了这个语句,奉献给大家。
以下例子需要把2021年之前的单据、凭证全部删除
1、把旧账套所有模块结账到2021年,2、备份旧账套,3、恢复账套,4、在恢复账套执行语句
根据实际情况替换删除截止日期2020-12-31 和截止年度2021
执行完语句后直接使用新账套就可以
UPDATE t_Voucher SET FChecked=0 WHERE FDATE<='2020-12-31'
UPDATE t_Voucher SET FCHECKERID=-1 WHERE FDATE<='2020-12-31'
UPDATE t_Voucher SET FPOSTED=0 WHERE FDATE<='2020-12-31'
UPDATE t_Voucher SET FPosterID=-1 WHERE FDATE<='2020-12-31'
UPDATE t_Voucher SET FInternalInd='NULL' FDATE<='2020-12-31'
UPDATE t_Voucher SET FParameter='NULL' FDATE<='2020-12-31'
DELETE FROM t_Voucher WHERE FDATE<='2020-12-31'
DELETE FROM t_VoucherEntry WHERE FVoucherID NOT IN (select FVoucherID FROM t_Voucher)
DELETE FROM T_BALANCE WHERE FYear<'2021'
--删除财务数据
UPDATE ICStockBill SET fstatus=0 WHERE FDATE<='2020-12-31'
UPDATE ICStockBill SET FCHECKERID=NULL WHERE FDATE<='2020-12-31'
UPDATE ICStockBill SET FPOSTED=0 WHERE FDATE<='2020-12-31'
UPDATE ICStockBill SET FPosterID=NULL WHERE FDATE<='2020-12-31'
DELETE FROM ICStockBill WHERE FDATE<='2020-12-31'
DELETE FROM ICBal WHERE FYear<'2021'
DELETE FROM ICINVBal WHERE FYear<'2021'
--删除库存单据
UPDATE ICSale SET fstatus=0 WHERE FDATE<='2020-12-31'
UPDATE ICSale SET FCHECKERID=NULL WHERE FDATE<='2020-12-31'
UPDATE ICSale SET FPOSTED=0 WHERE FDATE<='2020-12-31'
UPDATE ICSale SET FPosterID=NULL WHERE FDATE<='2020-12-31'
DELETE FROM ICSale WHERE FDATE<='2020-12-31'
--删除销售发票
UPDATE ICPurchase SET fstatus=0 WHERE FDATE<='2020-12-31'
UPDATE ICPurchase SET FCHECKERID=NULL WHERE FDATE<='2020-12-31'
UPDATE ICPurchase SET FPOSTED=0 WHERE FDATE<='2020-12-31'
UPDATE ICPurchase SET FPosterID=NULL WHERE FDATE<='2020-12-31'
DELETE FROM ICPurchase WHERE FDATE<='2020-12-31'
--删除采购发票
UPDATE T_SYSTEMPROFILE SET FVALUE='2021' WHERE FKEY='StartYear'
UPDATE T_SYSTEMPROFILE SET FVALUE='1' WHERE FKEY='StartPeriod'
--修改启用期间
--如果提示游标 错误 执行以下语句
close Cur
deallocate Cur
收付款单好像清理不掉
【emoji】
清除历史数据
本文2024-09-16 19:40:20发表“kis知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-kis-30148.html