select * from tb where col5 < 100 or col6 < 100 .....
--如果第4个字段后都是数值型,可以试试这个 declare @list varchar(8000) set @list='' select @list=@list+' and '+(b.name+'<100') from sysobjects a join syscolumns b on a.id=b.id where a.name='tb' and b.colid>4 select @list exec ('select * from tb where 1=1 '+@list)
from tb
where col5 < 100 or col6 < 100 .....
declare @list varchar(8000)
set @list=''
select @list=@list+' and '+(b.name+'<100') from sysobjects a join syscolumns b on a.id=b.id where a.name='tb' and b.colid>4
select @list
exec ('select * from tb where 1=1 '+@list)