Code --在整个库里查某个值 declare@strvarchar(100) set@str='6923346741083'--要搜索的字符串 declare@svarchar(8000) declare tb cursor local for select s='if exists(select 1 from ['+b.name+'] where convert(varchar,['+a.name+']) like ''%'+@str+'%'')
print ''select top 5 ['+a.name+'],* from ['+b.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,56,60,108,106) open tb fetchnextfrom tb into@s while@@fetch_status=0 begin exec(@s) fetchnextfrom tb into@s end close tb deallocate tb
posted on
2008-12-08 15:35scarroot
阅读(277)
评论(0)
收藏举报