Home  >  Article  >  Database  >  sql replace替换字符函数

sql replace替换字符函数

WBOY
WBOYOriginal
2016-06-07 17:51:341345browse

本文章介绍一个在sql中非常实用的函数replace,这个函数可以替换你指定的字符,如下在我们结合了update 语句来操作。


替换字符串函数replace可以实现把某字段的某些字符串替换成其他字符串,例如

 代码如下 复制代码

update dede_addonarticle set body=replace(body,'news/uploads/allimg/c110826','news/uploads/blank.gif?')

可以把dedecms的文章内容表所有的图片链接替换成空白图片,这样就可以去把已经上传的大量图片删除以节省空间了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn