解决方案: |
对于有正确的iaprice的值的数据执行脚本: update rdrecords set imoney=CONVERT(DECIMAL(20,2),iaprice) where convert(decimal(20,4),iquantity)=convert(decimal(20,4),isquantity) and isnull(imoney,0)<>iaprice GO update pursettlevouchs set isvacost=rdrecords.facost from pursettlevouchs left join rdrecords on rdrecords.autoid=pursettlevouchs.irdsid GO update rdrecords set iaprice=convert(decimal(20,2),iquantity*facost) where isquantity<>0 GO update rdrecords set imoney=convert(decimal(20,2),isquantity*facost) where autoid in(select autoid from rdrecords where iquantity <> isquantity and isquantity<>0) GO update rdrecords set iaprice=iprice,facost=iunitcost where isnull(iaprice,0)=0 and isquantity<>0 GO update rdrecords set imoney=convert(decimal(20,2),isquantity*facost) where isquantity<>0 and isnull(imoney,0)=0 GO update pursettlevouchs set isvaprice=convert(decimal(20,2),isvquantity*isvacost) GO update rdrecords set imoney=CONVERT(DECIMAL(20,2),iaprice) where convert(decimal(20,4),iquantity)=convert(decimal(20,4),isquantity) and isnull(imoney,0)<>iaprice GO update pursettlevouchs set isvacost=rdrecords.facost from pursettlevouchs left join rdrecords on rdrecords.autoid=pursettlevouchs.irdsid GO update rdrecords set iaprice=convert(decimal(20,2),iquantity*facost) where isquantity<>0 GO update rdrecords set imoney=convert(decimal(20,2),isquantity*facost) where autoid in(select autoid from rdrecords where iquantity <> isquantity and isquantity<>0) GO update rdrecords set iaprice=iprice,facost=iunitcost where isnull(iaprice,0)=0 and isquantity<>0 GO update rdrecords set imoney=convert(decimal(20,2),isquantity*facost) where isquantity<>0 and isnull(imoney,0)=0 GO update pursettlevouchs set isvaprice=convert(decimal(20,2),isvquantity*isvacost) GO |