DECLARE @StreetNumber varchar(10) SET @StreetNumber = '3505A' SELECT CAST(LEFT(@StreetNumber, PATINDEX('%[A-Z]%', @StreetNumber + 'A')-1) AS int)>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:
>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 >>