知识网2021年10月22日 12:23原创
很多站长朋友想要批量替换掉数据库某表中的某些内容,这个时候通过sql语句直接操作是最为快捷的,那么要如何进行替换呢,下面进行信息的介绍:
Mysql数据库批量替换内容的sql语句使用方法,以dedecms为例。
SQL语句表达式:
update `数据表名` set 字段名=replace(字段名,'不想要的内容','替换后显示的内容');
举多个例子:
1、替换文章的内容,包括链接,文字或是图片、附件等
update `dede_addonarticle` set body=replace(body,'要替换的内容','替换后显示的内容');
2、替换文章标题内的某文字
update `dede_archives` set title=replace(title,'要替换的内容','替换后显示的内容');
3、替换文章来源
update `dede_archives` set writer=replace(writer,'原来的编辑人名','替换后显示编辑人名');
4、替换文章的关键词
update `dede_archives` set keywords=replace(keywords,'原来的关键词','替换后显示的关键词');
5、替换关键词的链接
update `dede_keywords` set rpurl=replace(rpurl,'原来的域名','现在使用的新域名');
6、替换网站栏目title标签里的内容
update `dede_arctype` set seotitle=replace(seotitle,'不想要的内容','替换后显示的内容');
7、替换栏目description标签里的内容
update `dede_arctype` set description=replace(description,'不想要的内容','替换后显示的内容');
8、栏目关键词keywords标签里的内容
update `dede_arctype` set keywords=replace(keywords,'不想要的内容','替换后显示的内容');
本文章网址:https://www.shsongjiang.com/p21/
很赞哦!(26)