说明:
table_name —— 表的名字
field_name —— 字段名
from_str —— 需要替换的字符串
to_str —— 替换成的字符串
下面是今天运行的两句SQL批量替换语句,如果用到的可以参考下!
UPDATE boblog_blogs SET content = replace (content,'[mycode=xml]','[mycode=html]');
查询表 boblog_blogs 将 content 字段中的字符 [mycode=xml> 替换成 [mycode=html>
UPDATE boblog_blogs SET content = replace (content,'[//mycode]','[/mycode]');
查询表 boblog_blogs 将 content 字段中的字符 [//mycode> 替换成 [/mycode>
UPDATE boblog_blogs SET htmlstat=0 where htmlstat=1
查询表 boblog_blogs 将 htmlstat 字段中的值 0 替换成 1