首页 > 数据库 > mysql教程 > Sql 批量查看字符所在的表及字段

Sql 批量查看字符所在的表及字段

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2016-06-07 17:58:42
原创
1055 人浏览过

批量查看字符所在的表及字段的sql语句

代码如下:
declare @str varchar(100)
set @str='8f8el3l'

declare @s varchar(8000)
declare tb cursor local for
select s='if exists(select 1 from ['+b.name+'] where ['+a.name+'] like ''%'+@str+'%'')
print ''所在的表及字段: ['+b.name+'].['+a.name+']'''
from syscolumns a join sysobjects b on a.id=b.id
where b.xtype='U' and a.status>=0
and a.xusertype in(175,239,231,167)
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb
相关标签:
sql
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
php - prepare与sql的开销?
来自于 1970-01-01 08:00:00
0
0
0
sql文件
来自于 1970-01-01 08:00:00
0
0
0
打印sql语句
来自于 1970-01-01 08:00:00
0
0
0
sql优化or
来自于 1970-01-01 08:00:00
0
0
0
mysql - sql报错原因?
来自于 1970-01-01 08:00:00
0
0
0
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板