Tracy,
Is your number field in SQL not character also? If it is, you'll need to determine what you want to do with the letters in the number field. If it is indeed a character field, I don't see any problem as this works for me:
create table oMain (Number char(10))
insert into oMain values ('1058')
insert into oMain values ('1058A')
insert into oMain values ('1167')
insert into oMain values ('2054B')
insert into oMain values ('3001')
insert into oMain values ('3000A')
select * from oMain where number between '1100' and '3000'
drop table oMain
HTH,
Chad
>I need to pull a range of records based on the street number. The number field is character. The problem occurs when a letter was entered in the number field as well as in 300A, 3505B, etc. Both of the examples below return the error:
>
>Conversion failed when converting the varchar value '3505A ' to data type int.
>or:
>Error converting data type varchar to numeric.
>
>
>select * from omain where 1100 < number and 3000 > number
>select * from omain where cast((number) as decimal(10,0)) > 1000 and cast((number) as decimal(10,0)) < 3000
>
>
>Recommendations?
_________________________________
There are 2 types of people in the world: