Use UFDATA_002_2010 --这里要改为你的数套数据库名.
update ufsystem..ua_identity Set iFatherId=(Select Max(iid) As ID From UFDATA_002_2010..Ap_CloseBill),
iChildId=(Select Max(id) As AutoID From UFDATA_002_2010..Ap_CloseBills)
Where cAcc_Id='002' And cVouchType='sk' --cAcc_Id='你的账套号'
您好:请备份数据后执行如下语句:注意替换为cacc_id='001' 实际账套号
update UFSystem..ua_identity set ifatherid=(select max(iid) from ap_closebill) where cacc_id='001' and cvouchtype='SK'
update UFSystem..ua_identity set ichildid=(select max(id) from ap_closebills) where cacc_id='001' and cvouchtype='SK'