关闭

用友修改最大单据号SQL大全

2923人阅读 评论(0) 收藏 举报

ufsystem..ua_identity 字段标识描述主表字段子表字段
Rd收发记录主子表Rdrecord.idRdrecords.autoid
BILLVOUCH销售发票主子表SaleBillVouch.SBVID SaleBillVouchs.autoid
DISPATCH发货退货单主子表DispatchList.dlidDispatchLists.idlsid
POMain采购订单主子表PO_Pomain.POIDPO_Podetails.id
SOMain销售订单主子表SO_SOMain.idSO_SODetails.autoid
PURBILL采购发票主子表PurBillVouch.PBVIDPurBillVouchs.ID
PURSTID采购结算单主子表PurSettleVouch.PSVIDPurSettleVouchs.ID
SETTLEVOUCH委托代销结算单主子表SA_SettleVouch.IDSA_SettleVouchs.Autoid
Ju出入库调整单主子表JustInVouch.IDJustInVouch.Autoid
PUAPP采购请购单主子表PU_AppVouch.IDPU_AppVouchs.Autoid
PUARRIVAL采购到货单主子表PU_ArrivalVouch.IDPU_ArrivalVouchs.Autoid
Tr库存调拨单主子表TransVouch.IdTransVouchs.Autoid
EXPENSE代垫费用单主子表ExpenseVouch.IDExpenseVouchs.Autoid
Ch盘点单主子表CheckVouch.ID CheckVouchs.Autoid
Ma限额领料单主子表MatchVouch.IDMatchVouchs.Autoid
SALEPAY销售支出单主子表SalePayVouch.IDSalePayVouchs.Autoid
QUOMAIN销售报价单主子表SA_QuoMain.IDSA_QuoDetails.Autoid
XJ收付款单主子表(销售现结使用)Ap_CloseBill.ccancelnoAp_CloseBills.ID
SK收付款单主子表(收款cCancelNo is null)Ap_CloseBill.iIDAp_CloseBills.ID
OM_MO委外订单主子表OM_MOMain.MoidOM_MODetails.MODetailsID
OM_MS
委外结算主子表OM_MatSettleVouch.MSIDOM_MatSettleVouchs.MSDetailsID
OM_Materials委外用料表OM_MOMaterials.MOIDOM_MOMaterials.MOMaterialsID

下面是对应的更新语句
以002账套2010年度数据为例

update ufsystem..ua_identity Set iFatherId=(Select Max(ID) As ID From UFDATA_002_2010..RdRecord),
iChildId=(Select Max(AutoID) As AutoID From UFDATA_002_2010..RdRecords)
Where   cAcc_Id='002' And   cVouchType='rd' 
go
update ufsystem..ua_identity Set iFatherId=(Select Max(dlID) As ID From UFDATA_002_2010..DISPATCHlist),
iChildId=(Select Max(AUTOID) As AutoID From UFDATA_002_2010..DISPATCHlists)
Where   cAcc_Id='002' And   cVouchType='dispatch' 
go
update ufsystem..ua_identity Set iFatherId=(Select Max(SBVID) As ID From UFDATA_002_2010..SaleBillVouch),
iChildId=(Select Max(AutoID) As AutoID From UFDATA_002_2010..SaleBillVouchs)
Where   cAcc_Id='002' And   cVouchType='billvouch' 
go
update ufsystem..ua_identity Set iFatherId=(Select Max(poid) As ID From UFDATA_002_2010..po_POMain),
iChildId=(Select Max(id) As AutoID From UFDATA_002_2010..po_podetails)
Where   cAcc_Id='002' And   cVouchType='POMain' 
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..JustInVouch),
iChildId=(Select Max(autoid) As AutoID From UFDATA_002_2010..JustInVouchs)
Where   cAcc_Id='002' And   cVouchType='ju'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..PU_ArrivalVouch),
iChildId=(Select Max(autoid) As AutoID From UFDATA_002_2010..PU_ArrivalVouchs)
Where   cAcc_Id='002' And   cVouchType='puarrival'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..PU_ArrivalVouch),
iChildId=(Select Max(autoid) As AutoID From UFDATA_002_2010..PU_ArrivalVouchs)
Where   cAcc_Id='002' And   cVouchType='puarrival'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..PU_AppVouch),
iChildId=(Select Max(autoid) As AutoID From UFDATA_002_2010..PU_AppVouchs)
Where   cAcc_Id='002' And   cVouchType='puapp'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(pbvid) As ID From UFDATA_002_2010..PurBillVouch),
iChildId=(Select Max(id) As AutoID From UFDATA_002_2010..PurBillVouchs)
Where   cAcc_Id='002' And   cVouchType='purbill'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(psvid) As ID From UFDATA_002_2010..PurSettleVouch),
iChildId=(Select Max(id) As AutoID From UFDATA_002_2010..PurSettleVouchs)
Where   cAcc_Id='002' And   cVouchType='PURSTID'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..SA_QuoMain),
iChildId=(Select Max(autoid) As AutoID From UFDATA_002_2010..SA_Quodetails)
Where   cAcc_Id='002' And   cVouchType='QUOMAIN'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..SO_SOMain),
iChildId=(Select Max(isosid) As isosidFrom UFDATA_002_2010..SO_SOdetails)
Where   cAcc_Id='002' And   cVouchType='somain'
go
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'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..TransVouch),
iChildId=(Select Max(autoid) As AutoID From UFDATA_002_2010..TransVouchs)
Where   cAcc_Id='002' And   cVouchType='tr'
go
update ufsystem..ua_identity Set iFatherId=(Select Max(id) As ID From UFDATA_002_2010..ExpenseVouch),
iChildId=(Select Max(autoid) As AutoID From UFDATA_002_2010..ExpenseVouchS)
Where   cAcc_Id='002' And   cVouchType='EXPENSE'
go

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:50043次
    • 积分:850
    • 等级:
    • 排名:千里之外
    • 原创:33篇
    • 转载:7篇
    • 译文:0篇
    • 评论:13条
    最新评论