|
电脑新建一个html文件,把以下代码粘贴进去,浏览器打开html文件会看到两个框,一个替换前一个替换后,输入点击空白处即可生成批量替换sql。注意:可替换的内容已经做了标记,没写的是不能替换的,需要加进去,有需要的可以评论想要替换的内容。
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>sql mark</title>
- <script>
- function $(obj){return document.getElementById(obj);}
- function txtBlur(){
- var olds=$("old");
- var news=$("new");
- if(olds.value==""||news.value==""||olds.value==null||news.value==null){
- return;
- }
- var str="<div id="sql">update phome_ecms_news set keyboard=replace(keyboard,'"+olds.value+"','"+news.value+"');<br/>";//文章关键词
- str+="update phome_ecms_news set title=replace(title,'"+olds.value+"','"+news.value+"');<br/>";//文章标题
- str+="update phome_ecms_news set smalltext=replace(smalltext,'"+olds.value+"','"+news.value+"');<br/>";//文章内容
- str+="update phome_ecms_news_data_1 set infotags=replace(infotags,'"+olds.value+"','"+news.value+"');<br/>";//文章附表1文章tag
- str+="update phome_ecms_news_data_1 set newstext=replace(newstext,'"+olds.value+"','"+news.value+"');<br/>";//文章附表1未知
- str+="update phome_enewsclass set classname=replace(classname,'"+olds.value+"','"+news.value+"');<br/>";//栏目名称
- str+="update phome_enewsclass set bname=replace(bname,'"+olds.value+"','"+news.value+"');<br/>";//栏目别名
- str+="update phome_enewsclass set classpagekey=replace(classpagekey,'"+olds.value+"','"+news.value+"');<br/>";//栏目关键词
- str+="update phome_enewsclass set intro=replace(intro,'"+olds.value+"','"+news.value+"');<br/>";//栏目关键词
- str+="update phome_enewstags set tagname=replace(tagname,'"+olds.value+"','"+news.value+"');<br/>";//tag名称
- str+="update phome_enewstags set tagtitle=replace(tagtitle,'"+olds.value+"','"+news.value+"');<br/>";//tag标题
- str+="update phome_enewstags set tagkey=replace(tagkey,'"+olds.value+"','"+news.value+"');<br/>";//tag关键词
- str+="update phome_enewstags set tagdes=replace(tagdes,'"+olds.value+"','"+news.value+"');<br/>";//tag描述
- str+="update phome_enewstempbak set temptext=replace(temptext,'"+olds.value+"','"+news.value+"');<br/>";//模板备份表
- str+="update phome_enewstempvar set varvalue=replace(varvalue,'"+olds.value+"','"+news.value+"');<br/>";//公共模板
- str+="update phome_enewslisttemp set temptext=replace(temptext,'"+olds.value+"','"+news.value+"');<br/>";//列表模板
- str+="update phome_enewsnewstemp set temptext=replace(temptext,'"+olds.value+"','"+news.value+"');<br/>";//内容模板
- str+="update phome_enewspagetemp set temptext=replace(temptext,'"+olds.value+"','"+news.value+"');<br/>";//自定义模板
- str+="update phome_enewssearchtemp set temptext=replace(temptext,'"+olds.value+"','"+news.value+"');<br/>";//搜索模板
- str+="update phome_enewspubtemp set indextemp=replace(indextemp,'"+olds.value+"','"+news.value+"');<br/>";//首页模板
- str+="update phome_enewspublic set sitename=replace(sitename,'"+olds.value+"','"+news.value+"');<br/>";//站点名称
- str+="update phome_enewspublic set newsurl=replace(newsurl,'"+olds.value+"','"+news.value+"');<br/>";//网站地址
- str+="update phome_enewspublic set sitekey=replace(sitekey,'"+olds.value+"','"+news.value+"');<br/>";//网站关键字
- str+="update phome_enewspublic set siteintro=replace(siteintro,'"+olds.value+"','"+news.value+"');<br/>";//网站简介
- if($("sql")){
- $("sql").parentNode.removeChild($("sql"));
- }
- document.body.innerHTML+=str;
- }
- </script>
- </head>
- <body>
- <table width="200" border="1">
- <tr>
- <td>旧内容</td>
- <td>新内容</td>
- </tr>
- <tr>
- <td><input id="old" onblur="txtBlur()" /></td>
- <td><input id="new" onblur="txtBlur()" /></td>
- </tr>
- </table>
- </body>
- </html>
复制代码 以下是生成好的:
- update phome_ecms_news set keyboard=replace(keyboard,'旧内容','新内容');
- update phome_ecms_news set title=replace(title,'旧内容','新内容');
- update phome_ecms_news set smalltext=replace(smalltext,'旧内容','新内容');
- update phome_ecms_news_data_1 set infotags=replace(infotags,'旧内容','新内容');
- update phome_ecms_news_data_1 set newstext=replace(newstext,'旧内容','新内容');
- update phome_enewsclass set classname=replace(classname,'旧内容','新内容');
- update phome_enewsclass set bname=replace(bname,'旧内容','新内容');
- update phome_enewsclass set classpagekey=replace(classpagekey,'旧内容','新内容');
- update phome_enewsclass set intro=replace(intro,'旧内容','新内容');
- update phome_enewstags set tagname=replace(tagname,'旧内容','新内容');
- update phome_enewstags set tagtitle=replace(tagtitle,'旧内容','新内容');
- update phome_enewstags set tagkey=replace(tagkey,'旧内容','新内容');
- update phome_enewstags set tagdes=replace(tagdes,'旧内容','新内容');
- update phome_enewstempbak set temptext=replace(temptext,'旧内容','新内容');
- update phome_enewstempvar set varvalue=replace(varvalue,'旧内容','新内容');
- update phome_enewslisttemp set temptext=replace(temptext,'旧内容','新内容');
- update phome_enewsnewstemp set temptext=replace(temptext,'旧内容','新内容');
- update phome_enewspagetemp set temptext=replace(temptext,'旧内容','新内容');
- update phome_enewssearchtemp set temptext=replace(temptext,'旧内容','新内容');
- update phome_enewspubtemp set indextemp=replace(indextemp,'旧内容','新内容');
- update phome_enewspublic set sitename=replace(sitename,'旧内容','新内容');
- update phome_enewspublic set newsurl=replace(newsurl,'旧内容','新内容');
- update phome_enewspublic set sitekey=replace(sitekey,'旧内容','新内容');
- update phome_enewspublic set siteintro=replace(siteintro,'旧内容','新内容');
复制代码
|
|