mysql中替換字符串(正則) 模糊

例如: abcd(efg)hijk 替換以後是abcdhijk函數

update tabaleA set name = replace(name, substring(name, locate('<contact>', name),locate('</contact>', name)-locate('<contact>'+10, name)),'');

 執行以後,報錯:Truncated incorrect DOUBLE value解決辦法,通過查詢發現是concat(Str,’’)函數錯誤問題,有的DB支持+操做符,而有的就不能夠必須使用concat 函數。spa

將SQL修改以下:.net

update t_global_project set name = replace(name, substring(name, locate('<contact>', name),locate('</contact>', name)-locate(concat('<contact>','10'), name)),'');

 

參考文章:code

http://blog.csdn.net/beenin/article/details/5506793blog

http://babyjoycry.iteye.com/blog/609276get

相關文章
相關標籤/搜索