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'