复制代码 代码如下:
declare @t varchar(255),@c varchar(255)
declare table_cursor cursor for select a.name,b.name
from sysobjects a,syscolumns b ,systypes c
where a.id=b.id and a.xtype='u' and c.name
in ('char', 'nchar', 'nvarchar', 'varchar','text','ntext'/* --这里如果你的text(ntext)类型没有超过8000(4000)长度,才可以使用*/)
declare @str varchar(500),@str2 varchar(500)
set @str='<script src=fasfdasfasf ></script> ' /*这里是你要替换的字符*/
set @str2='' /*替换后的字符*/
open table_cursor
fetch next from table_cursor
into @t,@c while(@@fetch_status=0)
begin exec('update [' + @t + '] set [' + @c + ']=replace(cast([' + @c + '] as varchar(8000)),'''+@str+''','''+ @str2 +''')')

fetch next from table_cursor
into @t,@c end close table_cursor deallocate table_cursor;

更多相关文章

  1. MySQL 5.7.9 服务无法启动-“NET HELPMSG 3534”的解决方法
  2. ES6 变量声明,箭头函数,数组方法,解构赋值,JSON,类与继承,模块化练习
  3. 浅谈Java中Collections.sort对List排序的两种方法
  4. Python list sort方法的具体使用
  5. python list.sort()根据多个关键字排序的方法实现
  6. android上一些方法的区别和用法的注意事项
  7. android实现字体闪烁动画的方法
  8. Android中dispatchDraw分析
  9. Android四大基本组件介绍与生命周期

随机推荐

  1. Linux软件管理-YUM
  2. SUSE12SP3-Mycat(3)Server.xml配置详解
  3. UNIX-LINUX编程实践教程->第八章->实例代
  4. 在linux mint x x64上安装xv6
  5. 在linux操作系统下,进行j2ee的web开发,是怎
  6. DB2 v8.1 for Linux无法安装!求助!
  7. [置顶] linux下Redis服务器部署过
  8. shell用户配置详解及bash命令参数
  9. Linux - 模块编程初试
  10. linux下sqlite3可视化工具