问题原因: |
一、问题现象: 升级到脚本data860_ia.sql时发生错误, 错误信息: -2147217833 将截断字符串或二进制数据 执行如下语句时出错: --明细帐数据升级脚本 gp 2004-4-21 update ia_subsidiary set ia_subsidiary.cbatchia = rdrecords.cbatch, ia_subsidiary.dmadedateia = rdrecords.dmadedate, ia_subsidiary.imassdateia = rdrecords.imassdate, ia_subsidiary.cmassunit = rdrecords.cmassunit, ia_subsidiary.dvdateia = rdrecords.dvdate, ia_subsidiary.csaleordercode = so_somain.csocode, ia_subsidiary.isaleorderid = so_somain.[id], ia_subsidiary.isaleordersid = so_sodetails.autoid, ia_subsidiary.isaleorderids = so_sodetails.irowno, ia_subsidiary.cpurordercode = po_pomain.cpoid, ia_subsidiary.ipurordersid = po_podetails.[id], ia_subsidiary.idlsid = dispatchlists.dlid, ia_subsidiary.inum = rdrecords.inum, ia_subsidiary.cassunit = rdrecords.cassunit from ia_subsidiary left join rdrecords on ia_subsidiary.[id] = rdrecords.autoid left join rdrecord on (rdrecords.[id] = rdrecord.[id] and ia_subsidiary.cvoutype = rdrecord.cvouchtype) left join so_sodetails on rdrecords.isodid = so_sodetails.isosid left join so_somain on so_sodetails.[id] = so_somain.[id] left join po_podetails on rdrecords.iposid = po_podetails.[id] left join po_pomain on po_podetails.poid = po_pomain.poid left join dispatchlists on rdrecords.idlsid = dispatchlists.autoid where ia_subsidiary.cvoutype = '01' or ia_subsidiary.cvoutype = '08' or ia_subsidiary.cvoutype = '09' or ia_subsidiary.cvoutype = '10' or ia_subsidiary.cvoutype = '11' or ia_subsidiary.cvoutype = '32' go
二、问题分析: ‘将截断字符串或二进制数据’错误应是更新数据时,源数据非法,如类型不匹配,长度过长等原因; 对update语句中的set对象,对每一个更新字段分别执行,以准确定位错误发生的具体字段位置; 当单独执行 update ia_subsidiary set ia_subsidiary.cpurordercode = po_pomain.cpoid from ...时报同样错误, 查询select ia_subsidiary.cpurordercode,po_pomain.cpoid from ... order by po_pomain.cpoid desc 分析方向:
1、检查非法字符;
2、检查数据长度(select max(len(cpoid)) from po_pomain,返回值29); 检查数据表中字段属性: ia_subsidiary.cpurordercode:varchar(20) po_pomain.cpoid:varchar(30)
问题原因:采购订单中cpoid可以允许30位长,而且也存在20多位的数据记录,更新存货明细帐时,写入目标字段定长只有20,故发生‘将截断字符串或二进制数据’错误。 问题2: 继续升级,当升级到脚本DPRD860_ST.sql时报错; 后台跟踪查询,发现执行‘过程dbd_zq’时出错,但脚本中未涉及到过程dbd_zq; 故怀疑可能存在用户自行添加的触发器,查看表transvouch,存在触发器dbd_zq,对比模板库、演示帐套,均不存在该触发器。 |