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

相关文章
相关标签/搜索