博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
修复被注入的sql server
阅读量:7231 次
发布时间:2019-06-29

本文共 1375 字,大约阅读时间需要 4 分钟。

declare @delStr nvarchar(500)set @delStr=''----这边修改被注入的jsset nocount ondeclare @tableName nvarchar(100),@columnName nvarchar(100),@tbID int,@iRow int,@iResult intdeclare @sql nvarchar(500)set @iResult=0declare cur cursor forselect name,id from sysobjects where xtype='U'open curfetch next from cur into @tableName,@tbIDwhile @@fetch_status=0begin   declare cur1 cursor for        --xtype in (231,167,239,175) 为char,varchar,nchar,nvarchar类型        select name from syscolumns where xtype in (231,167,239,175) and id=@tbID   open cur1   fetch next from cur1 into @columnName   while @@fetch_status=0   begin      begin try         set @sql='update [' + @tableName + '] set ['+ @columnName +']= replace(['+@columnName+'],'''+@delStr+''','''') where ['+@columnName+'] like ''%'+@delStr+'%'''                   exec sp_executesql @sql               set @iRow=@@rowcount         set @iResult=@iResult+@iRow         if @iRow>0          begin            print '表:[' + @tableName + '],列:'+@columnName+'被更新'+convert(varchar(10),@iRow)+'条记录;'         end            end try       begin catch      end catch      fetch next from cur1 into @columnName   end   close cur1   deallocate cur1      fetch next from cur into @tableName,@tbIDendprint '数据库共有'+convert(varchar(10),@iResult)+'条记录被更新!!!'close curdeallocate curset nocount off

 

转载于:https://www.cnblogs.com/Yellowshorts/p/3580376.html

你可能感兴趣的文章
【SICP练习】135 练习3.66
查看>>
数据挖掘——文本挖掘-关键字提取
查看>>
Codeforces Gym - 101102A - Coins
查看>>
webstorm识别 ftl文件
查看>>
在Window 下安装Redis数据库
查看>>
主席树 | | 可持久化线段树
查看>>
JSTL中c:set标签的要点和技巧
查看>>
arp命令
查看>>
微信公众号的localStorage的大坑
查看>>
lua算法(连载)
查看>>
IE6、7下overflow:hidden失效的问题
查看>>
php的静态化
查看>>
asp.net 中使用 pagedlist 分页并具有查询功能的实现方法
查看>>
(二)UML之类图、接口、包
查看>>
Google Protocol Buffer入门
查看>>
DataTable.AcceptChanges方法有何用处
查看>>
canvas
查看>>
win7 远程桌面连接centos 6.5
查看>>
机器学习中使用「正则化来防止过拟合」到底是一个什么原理?为什么正则化项就可以防止过拟合?...
查看>>
POJ 1696 Space Ant
查看>>