解决方案: |
--客户业务员余额,结转后无业务专管员,在凭证明细表中增加业务专管员
UPDATE GL_accvouch
SET cname = cc.cpersonname
FROM (SELECT a.ccuscode, a.ccuspperson, b.cpersonname
FROM Customer a, person b
WHERE a.ccuspperson = b.cpersoncode) cc
WHERE (iperiod = 0) AND (ccode LIKE '1131%') AND (cc.ccuscode = ccus_id)
--供应商业务员余额,结转后无业务专管员,在凭证明细表中增加业务专管员
UPDATE GL_accvouch
SET cname = cc.cpersonname
FROM (SELECT a.cvencode, a.cvenpperson, b.cpersonname
FROM Vendor a, person b
WHERE a.cvenpperson = b.cpersoncode) cc
WHERE (iperiod = 0) AND (ccode LIKE '122') AND (cc.cvencode = csup_id) |