Hi
One solution is to use conversion for @testVal
select *
from NumericOnly
where convert(varchar(4),@testVal) between NStart and NEnd
Another solution is to use a temp tables like for e.g. below:
declare @NumericOnly table(Nstart smallint,Nend smallint)
insert into @NumericOnly
select convert(smallint,start) NStart, convert(smallint,[end]) NEnd
from @table
where start not like '%[^0-9]%'
and [end] not like '%[^0-9]%'
select *
from @NumericOnly
where @testVal between NStart and NEnd
Regards,
Igor
Igor Micev,My blog: www.igormicev.com