不知道某一个值在哪个字段中有符合的.需要遍历表中所有int型字段.查询符合某值的记录.
一条语句或者一个过程都行.

解决方案 »

  1.   

    where  a or b or c
      

  2.   

    设计问题
    select 字段a from tb where 。
    union all
    select 字段b from tb where 。
    union all
    select 字段c from tb where 。
    union all
    select 字段d from tb where 。union all
    select 字段e from tb where 。
    ...............
      

  3.   

    exec sp_msforeachtable N' 
    declare @tableName nvarchar(256), @sql nvarchar(4000),@value int
    set @tableName=parsename(''?'',1) 
    set @sql=N''''
    set @value=100select @sql=@sql+N'' union all select ''''''+@tableName+'''''' as tableName from ''+@tableName+'' where ''+name+''=''''''+rtrim(@value)+''''''''
    from syscolumns
    where id=object_id(@tableName)  and  type_name(xtype)=''int''set @sql=stuff(@sql,1,10,'''')
    --print @sql
    exec(@sql)
    '
      

  4.   

    遍历所有表,所有字段类型是int的字段值是否等于100。
      

  5.   

    不是,只是一个表.
    不需要union的.