LSX-blog

Feed Rss

【原创】遍历数据库字段

11.28.2011, MSSQL, by .

最近领导让看一下数据库是否有问题,怀疑可能有注入,但也不能确认,随后要检查数据库,数据库太多了,我不可能一个一个的看,下面是通过SQL语句来实现,遍历查找:
declare @word nvarchar(20)
set @word=’5sejk.com’ //查找的字段中的内容
–取出数据库所有表名
declare tables 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)

declare @tablename sysname,@field sysname
open tables
fetch next from tables into @tablename,@field
while(@@fetch_status=0)
begin
declare @sql nvarchar(500)
set @sql= ’declare @count int; select @count=count(1) from ['+@tablename+'] where convert(nvarchar(100),['+@field+']) like ”’+'%’+@word+’%”;’+’if(@count>0) print ”’+@tablename+”+’(‘+”+@field+’)”’
exec(@sql)
fetch next from tables into @tablename,@field
end
close tables
deallocate tables

【原创】遍历数据库字段 有 11 条回应

  1. is pfizer nebenwirkungen

    57d6 wow look it is is

    回复
  2. be is on line 40mg

    4a82 is versand ohne rezept

    回复
  3. be is oral jelly

    70e5 is female pink

    回复
  4. is ato collaterali

    82f8 farmacia de india is

    回复
  5. in tijuana viagra pharmacy buy

    回复
  6. is after effects

    fe25 prezzo basso di is

    回复
  7. venta is en peru

    05d6 try it best is

    回复
  8. consumo de is problemas

    9721 cheap is cheap is

    回复
  9. cheap off brand is

    cff1 is tiemp

    回复
  10. 5mg is lilly online

    0fe2 enter site being is

    回复
  11. is every day

    8ee0 is costo svizzera

    回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注