成都网站建设设计

将想法与焦点和您一起共享

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

这篇文章给大家介绍Sql 中怎么批量查看字符所在的表及字段,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

创新互联是一家专业提供淄川企业网站建设,专注与网站制作、成都网站制作H5页面制作、小程序制作等业务。10年已为淄川众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。

代码如下: 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 中怎么批量查看字符所在的表及字段就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


本文题目:Sql中怎么批量查看字符所在的表及字段
当前网址:http://chengdu.cdxwcx.cn/article/jgdjeg.html