复杂的办法是,通过系统表sysobjects找出所有的用户表,再通过遍历每个表的每个字段来查找"1101"这个值,遍历表可以借助系统表syscolumns知道每个表包含的字段

解决方案 »

  1.   

    to:supercamel(徐风微微) 
    能不能举个例子啊,全文索引我没有用过,谢谢
    to:zjcxc(邹建)
    这个方法实在太复杂了,我这个库有2000多张表
      

  2.   

    你怎么弄个这个题出来?晕~~~~~~~~哈哈自己去改该:declare  cursor1 cursor for select name from sysobjects where xtype='u'
    declare @i varchar(1000),@y varchar(1000),@sql nvarchar(4000),@result int
    open cursor1
    fetch cursor1 into @i
    while @@fetch_status=0
    begin
      select @y=''
      select @y=@y+'case when isnumeric(['+a.name+'])=1 then '+a.name+' end=1101 or ' from syscolumns a,sysobjects d where a.id=d.id and d.xtype='U' and d.name=@i
      select @y=left(@y,len(@y)-4),@sql=N'set @i=case when exists(select 1 from '+@i+' where '+@y+' ) then 1 else 0 end'  exec sp_executesql @sql,N'@i int output',@result output
      if @result=1
        select @i
      fetch cursor1 into @i
    end
    close cursor1
    deallocate cursor1