在A0应用中,发现一个被审计单位会计科目不按规则编码,科目长度不规则,二级科目长度有7位、8位、9位,三级科目长度有10位、11位、12位。因此,不能直接导入财务数据,需对会计科目表进行处理后才能导睡熟AO系统。采集语句如下: select faccountid as科目内码,fname as科目名称,ffull-name as科目全称, case when flevel=l then fnumber when len (fnumber)=7 and fleve1:2 then left (fnumber,4)+'00'+right (fnumber,2) when len (fnumber)=8 and flevel=2 then left (fnumber,4)+'0'+right ( fnumber,3 ) when len (fnumber)=9 and flevel=2 then left (fnumber,4)+right (fnumber,4) when len(fnumber)=11 and flevel=3 then left (fnumber,4) +'0',+substrlng (thumber,6,3 ) +'00' +right(fnumber,2) when len(fnumber)=12 and flevel=3 then left (fnumber,4)+'0' +substdng (fnumber,6,3 ) +'0' +right(fnumber,3 ) when len(fnumber)=10 and flevel=3 then left (fnumber,4) +'00' +substrlng (fnumber,6,2) +'00' +right (fnumber,2) end as科目编码into会计科目表 fromt_account 上面生成规则的会计科目表,直接就可导入AO系统了。