--begin----------备份相关的数据createtabelgl_voucher_0105asselect*fromgl_voucherwherepk_accountingbook=(selectpk_accountingbookfromorg_accountingbookwherecode='1031001-0001')andyear='2014'andperiod='08'andnum=1131anddr=0;createtabelgl_detail_0105asselect*fromgl_detailwherepk_accountingbook=(selectpk_accountingbookfromorg_accountingbookwherecode='1031001-0001')andyearv='2014'andperiodv='08'andnov=1131anddr=0;createtabelgl_vouchermaxno_0105asselect*fromgl_vouchermaxnowherepk_accountingbook=(selectpk_accountingbookfromorg_accountingbookwherecode='1031001-0001')andyear='2014'andperiod='08';----------查询出重复的两张凭证,选其中的一张修改凭证号,找出其中一张的pk_voucherselect*fromgl_voucherwherepk_accountingbook=(selectpk_accountingbookfromorg_accountingbookwherecode='0027013-0002')andyear='2014'andperiod='08'andnum=1131anddr=0;----------更新相关数据updategl_vouchersetnum=(selectmaxno+1fromgl_vouchermaxnowherepk_accountingbook=(selectpk_accountingbookfromorg_accountingbookwherecode='0027013-0002')andyear='2014'andperiod='08';)wherepk_voucher='选出需要修改的凭证的pk_voucher';updategl_detailsetnov=(selectmaxno+1fromgl_vouchermaxnowherepk_accountingbook=(selectpk_accountingbookfromorg_accountingbookwherecode='0027013-0002')andyear='2014'andperiod='08')wherepk_voucher='选出需要修改的凭证的pk_voucher';updategl_vouchermaxnosetmaxno=maxno+1wherepk_accountingbook=(selectpk_accountingbookfromorg_accountingbookwherecode='0027013-0002')andyear='2014'andperiod='08';--end