declare @str varchar(100)
set @str='系统'
declare @s varchar(max)
declare c_tb cursor local for --申明游标
  select b='if exists(select 1 from  ['+b.name+'] where ['+a.name+'] like ''%'+@str+'%'')  
  print  ''select ['+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) 
open c_tb
fetch next from c_tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from c_tb into @s
end
close c_tb
deallocate c_tb

相关文章:

  • 2022-12-23
  • 2021-07-09
  • 2021-09-21
  • 2021-06-25
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-02
  • 2022-01-08
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案