KIS专业版
--修正核算项目关系
select * from t_itemdetail
exec sp_cleanitemdetailv
GO
update a set a.fdetailcount=b.Fcount
from t_itemdetail a join (select Fdetailid,count(*) as Fcount from t_itemdetailv where fitemid=-1 group by Fdetailid) b
on a.fdetailid=b.fdetailid where a.fdetailcount<>b.Fcount
--修正核算项目关系完
--原因分析
--丢失F列,还需要进行F列的补回,t_itemdetail表中缺少列F3001
--解决方案
--补回此列,如果有数据发生还要补回数据
If Not Exists(Select c.Name from syscolumns c,sysobjects o
where c.Id=o.Id and c.name='F3001' and o.name='t_ItemDetail')
Begin
Alter Table t_ItemDetail Add F3001 int not null default(0)
Create Index ix_ItemDetail_3001 On t_ItemDetail(F3001)
END
其他
1、凭证过账时系统提示:名称或代码在系统中已经被使用
错误代码:3604(E14H)
Source :Microsoft OLE DB Provider for SQL Server
Detail :在结果列的列表中多次出现列名 'F8'
执行语句校正即可
update d set d.fdetailcount=v.fcount
from t_ItemDetail d,
(select fdetailid,count(*) fcount from t_ItemDetailv where fitemid=-1 group by fdetailid ) v
where d.fdetailid=v.fdetailid
不同的账套,可能会提示不同的列名,如F1等,请变通执行
错误原因:核算项目横表t_itemdetail的核算项目类别数目和科目挂的核算项目数目不一致
2、在查询科目余额表并选择包括核算项目时,系统提示:
名称或代码在系统中已被使用
错误代码:3604(E14H)
Fdetail:列名'F3001'无效
补回此列,如果有数据发生还要补回数据
If Not Exists(Select c.Name from syscolumns c,sysobjects o
where c.Id=o.Id and c.name='F3001' and o.name='t_ItemDetail')
Begin
Alter Table t_ItemDetail Add F3001 int not null default(0)
Create Index ix_ItemDetail_3001 On t_ItemDetail(F3001)
END
如果还存在其他列名无效,参照修改上述SQL中的列名后,进行添加。
错误原因:在t_itemdetail表中缺少列F3001
3、录入凭证时提示错误代码:3604(E14H), Source :Microsoft OLE DB Provider for SQL Server Detail :分布式事务已完成。请将此会话登记到新事务或 NULL 事务中
此问题是由凭证最大内码号超过2147483647造成的,请参考以下SQL处理
select distinct(fvoucherid) AS Foldid,IDENTITY(int,1,1) as fnewid into #tmpa from t_voucher----建立新旧凭证内码对应关系
update a set a.fvoucherid=b.fnewid from t_voucher a , #tmpa b where a.fvoucherid=b.folded-----用新内码替换旧内码
update a set a.fvoucherid=b.fnewid from t_voucherentry a , #tmpa b where a.fvoucherid=b.foldid
update t_identity set fnext=(select max(fvoucherid) from t_voucher) 1 where fname='t_voucher'