SQL更新-金蝶k3-凭证摘要中的某些字符串比如撇

用sql语句替换金蝶凭证摘要中的某些字符串

--***********************************************
--金蝶摘要中,有时候,我们需要将某些字符串替换掉,比如字母等,我们知道替换的函数和格式为:
--Update Crm_Contact  SET Crm_Contact.cMobilePhone  = REPLACE(cMobilePhone, 'a', '3') where Crm_Contact.cContactName  like '%王伟%'
--但是遇到要替换一些特殊的字符,比如空格,换行符,撇等等,有时候符号回合sql的语句符号冲突,这里建议采用ASCII('a')的方式类处理,举例如下:
-------------------------------------------
--更新金蝶凭证表的摘要,将特殊字符撇<'>去掉
    Update t_voucher           SET t_voucher.fexplanation            = REPLACE(fexplanation, char(39), '')      --凭证头
    Update t_voucherentry  SET t_voucherentry.fexplanation  = REPLACE(fexplanation, char(39), '')      --凭证体
-------------------------------------------
--查看更新后的结果
    select fexplanation as 摘要, * from  t_voucher                              --凭证头表
    select fexplanation as 摘要, * from  t_voucherentry                    --凭证体表
    select fexplanation as 摘要, * from  t_VoucherBlankOut            --作废凭证表
-------------------------------------------
--金蝶报表后台常用表结构
    -----------------------------
    select * from  t_balance                             --科目余额表
    select * from  t_quantitybalance             --数量科目余额表 
    select * from  t_profitandloss                  --损益类科目,实际发生额表
--***********************************************

扩展知识:

--看ASCII码
print ASCII('a')
 
--tab 9  回车13  换行10  空格32  ' " , : ; . 
update Inventoty set name=replace(name,char(9),'') 
update Inventoty set name=replace(name,char(10),'') 
update Inventoty set name=replace(name,char(13),'') 
update Inventoty set name=replace(name,char(32),'')
update Inventoty set name=replace(name,'''','')
update Inventoty set name=replace(name,'"','')
update Inventoty set name=replace(name,',','')
update Inventoty set name=replace(name,':','')
update Inventoty set name=replace(name,';','')
update Inventoty set name=replace(name,'.','')

--***********************************************