解决方案: |
1.保留用户的数据,重新结转一个新的账套。用来获得正确的数据;
2.将正确的数据,插入用户现在的账套中,具体脚本可参考如下(ufdata_300_2005是重新结转的正确账套):
--选择未被结转的数据,注意autoid字段未被选中,因为它是自增长字段
SELECT [bRdFlag], [cBusType], [cBusCode], [cVouCode], [InID], [OutID], [dVouDate], [dKeepDate], [iMonth], [iPZID], [iPZDate], [cPZtype], [cPZdigest], [cOutHead], [cOppHead], [cVouType], [cSTCode], [cWhCode], [cAccDep], [cInvCode], [cRdCode], [cCusCode], [cBillCode], [cDLCode], [cDepCode], [cPersonCode], [cHandler], [iAInQuantity], [iAOutQuantity], [iInCost], [iOutCost], [iAInPrice], [isoutquantity], [isoutmoney], [iAOutPrice], [cBatchCode], [cAccounter], [cMaker], [bMoneyFlag], [bSale], [cMemo], [cDefine1], [cDefine2], [cDefine3], [cDefine4], [cDefine5], [cDefine6], [cDefine7], [cDefine8], [cDefine9], [cDefine10], [cFree1], [cFree2], [cPZID], [cDefine22], [cDefine23], [cDefine24], [cDefine25], [cDefine26], [cDefine27], [cItem_class], [cItemCode], [cName], [cItemCName], [cFree3], [cFree4], [cFree5], [cFree6], [cFree7], [cFree8], [cFree9], [cFree10], [cDefine11], [cDefine12], [cDefine13], [cDefine14], [cDefine15], [cDefine16], [cDefine28], [cDefine29], [cDefine30], [cDefine31], [cDefine32], [cDefine33], [cDefine34], [cDefine35], [cDefine36], [cDefine37], [iEnID]
into Tempaaa
FROM [UFDATA_300_2005].[dbo].[IA_EnSubsidiary]
where (IA_EnSubsidiary.cBusType='委托代销' Or IA_EnSubsidiary.cBusType='委托' ) AND iMonth=0
and inid not in (select inid from ufdata_200_2005..IA_EnSubsidiary Where (cBusType='委托代销' Or cBusType='委托' ) AND iMonth=0
)
--插入上一步中临时表的数据到用户账套
INSERT INTO [UFDATA_200_2005].[dbo].[IA_EnSubsidiary]([bRdFlag], [cBusType], [cBusCode], [cVouCode], [InID], [OutID], [dVouDate], [dKeepDate], [iMonth], [iPZID], [iPZDate], [cPZtype], [cPZdigest], [cOutHead], [cOppHead], [cVouType], [cSTCode], [cWhCode], [cAccDep], [cInvCode], [cRdCode], [cCusCode], [cBillCode], [cDLCode], [cDepCode], [cPersonCode], [cHandler], [iAInQuantity], [iAOutQuantity], [iInCost], [iOutCost], [iAInPrice], [isoutquantity], [isoutmoney], [iAOutPrice], [cBatchCode], [cAccounter], [cMaker], [bMoneyFlag], [bSale], [cMemo], [cDefine1], [cDefine2], [cDefine3], [cDefine4], [cDefine5], [cDefine6], [cDefine7], [cDefine8], [cDefine9], [cDefine10], [cFree1], [cFree2], [cPZID], [cDefine22], [cDefine23], [cDefine24], [cDefine25], [cDefine26], [cDefine27], [cItem_class], [cItemCode], [cName], [cItemCName], [cFree3], [cFree4], [cFree5], [cFree6], [cFree7], [cFree8], [cFree9], [cFree10], [cDefine11], [cDefine12], [cDefine13], [cDefine14], [cDefine15], [cDefine16], [cDefine28], [cDefine29], [cDefine30], [cDefine31], [cDefine32], [cDefine33], [cDefine34], [cDefine35], [cDefine36], [cDefine37], [iEnID])
select * from tempaaa
--删除临时表
drop table tempaaa
|