|
发表于 2017-6-9 08:56:28
|
显示全部楼层
本帖最后由 lzgzmn 于 2017-6-9 09:02 编辑
汇总科目都是明细科目数据汇总来的,GL_Yeb里应该只有明细科目数据,否则前台这些非明细科目余额会不对,应该删除GL_Yeb表中所有非明细科目行。
附“ 删除余额表中重复行”脚本仅供参考
/*
删除余额表中重复行,仅 适用R7版本,GRP-U8版请自行修改
注意:使用前对账套进行整库备份;
由于此脚本对数据进行较大调整,请谨慎使用!!!
此脚本为供服务工程师维护时提供借鉴,本公司及个人对因使用此脚本产生的一切不良后果不承担任何责任!!!
*/
IF EXISTS(SELECT name
FROM sysobjects
WHERE name = N'gl_yeb_bak'
AND type = 'U')
DROP TABLE gl_yeb_bak
go
IF EXISTS(SELECT name
FROM sysobjects
WHERE name = N'gl_yebk_bak'
AND type = 'U')
DROP TABLE gl_yebk_bak
go
SET XACT_ABORT ON
Begin Transaction
select * into gl_yeb_bak from gl_yeb
select * into gl_yebk_bak from gl_yebk
delete from gl_yeb
delete from gl_yebk
insert into gl_yeb
select distinct kjnd,kmdm,yeblx,wbdm,gsdm,fzdm0,fzdm1,fzdm2,fzdm3,fzdm4,fzdm5,fzdm6,fzdm7,fzdm8,fzdm9,fzdm10,zdylb,zdydm,ncj,ncd,yj1,yd1,yj2,yd2,yj3,yd3,yj4,yd4,yj5,yd5,yj6,yd6,yj7,yd7,yj8,yd8,yj9,yd9,yj10,yd10,yj11,yd11,yj12,yd12,yj13,yd13 from gl_yeb_bak
insert into gl_yebk
select distinct kjnd,kmdm,yeblx,wbdm,gsdm,fzdm0,fzdm1,fzdm2,fzdm3,fzdm4,fzdm5,fzdm6,fzdm7,fzdm8,fzdm9,fzdm10,zdylb,zdydm,ncj,ncd,yj1,yd1,yj2,yd2,yj3,yd3,yj4,yd4,yj5,yd5,yj6,yd6,yj7,yd7,yj8,yd8,yj9,yd9,yj10,yd10,yj11,yd11,yj12,yd12,yj13,yd13 from gl_yebk_bak
if @@error=0
begin
Commit transaction
end else
begin
rollback transaction
end
SET XACT_ABORT OFF
|
|