SQL中有系统表记录着你的所有表和所有字段
你可以从中选择是字符串的字段来查询

解决方案 »

  1.   

    我记得有个全文search,你不妨找找相关资料。
      

  2.   

    IF EXISTS (SELECT name FROM sysobjects          WHERE name = 'searchname' AND type = 'P')   DROP PROCEDURE searchnameGocreate procedure searchname @sname varchar(10)Asbegincreate table #TableList(  tablename  char(200),  colname char(200)) declare @table varchar(200)declare @col varchar(200) set nocount ondeclare curTab scroll cursor for select name from sysobjects where xtype='u'open curTabfetch next from curTab into @tablewhile @@FETCH_STATUS=0begin  declare curCol scroll cursor for select name from syscolumns where (xtype=175 or xtype=167) and (id in (select id from sysobjects where name=@table))  open curCol  fetch next from curCol into @col  while @@FETCH_STATUS=0  begin    execute('insert into #TableList select '''+@table+''','''+@col+''' from '+@table+' where '+@col+'='''+@sname+'''')    fetch next from curCol into @col  end  close curCol  deallocate curCol  fetch next from curTab into @tableendclose curTabdeallocate curTabset nocount offselect  distinct * from #TableListdrop table #tablelist  end调用SearchName ‘张三’