--应收流水增加源单编号字段对历史数据的升级 
update T_Ar_JOURNAL a set fbillno = (select b.fbillno from t_ar_finarbill b where b.fid = a.fsourcebillid and a.fbillno<>b.fbillno) 
 where exists(select 1 from t_ar_finarbill b where a.fsourcebillid=b.fid and a.fbillno<>b.fbillno );
update T_Ar_JOURNAL a set fbillno = (select b.fbillno from t_ar_busbill b where b.fid = a.fsourcebillid and a.fbillno<>b.fbillno) 
 where exists(select 1 from t_ar_busbill b where a.fsourcebillid=b.fid and a.fbillno<>b.fbillno );
update T_Ar_JOURNAL a set fbillno = (select b.fbillno from t_ar_receivedbill b where b.fid = a.fsourcebillid and a.fbillno<>b.fbillno) 
 where exists(select 1 from t_ar_receivedbill b where a.fsourcebillid=b.fid and a.fbillno<>b.fbillno );
update T_Ar_JOURNAL a set fbillno = (select b.fbillno from T_CAS_ReceivingBill b where b.fid = a.fsourcebillid and a.fbillno<>b.fbillno) 
 where exists(select 1 from T_CAS_ReceivingBill b where a.fsourcebillid=b.fid and a.fbillno<>b.fbillno );
update T_Ar_JOURNAL a set fbillno = (select b.fbillno from t_ap_settlerecord b where b.fid = a.fsourcebillid and a.fbillno<>b.fbillno and a.fsourceentryid=0) 
 where exists(select 1 from t_ap_settlerecord b where a.fsourcebillid=b.fid and a.fbillno<>b.fbillno and a.fsourceentryid=0);
update T_Ar_JOURNAL a set fbillno = (select b.fbillnum from t_ap_settlerecordentry b where b.fid = a.fsourcebillid and a.fbillno<>b.fbillnum and a.fsourceentryid=b.fentryid) 
 where exists(select 1 from t_ap_settlerecordentry b where a.fsourcebillid=b.fid and a.fbillno<>b.fbillnum and a.fsourceentryid=b.fentryid);