Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparison problems
Message
From
26/10/2005 11:09:42
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Comparison problems
Miscellaneous
Thread ID:
01062225
Message ID:
01062225
Views:
61
I have a StreetNumber column that is CHAR(8). It needs to be character, because you can have alpha in a street number, ie: 102A First St. The problem is that I need to provide the capability to search on a range of street numbers.

Simply using
WHERE StreetNumber >= '300' and StreetNumber < '500'
won't work, because of the fact that it returns numbers like 35, 42, etc.

But, because of the possibility of alpha characters, I cannot use CAST or CONVERT to compare numerically. I thought the answer would be to pad with leading zeros and continue to do a string comparison ... but how does one do that with T-SQL? There is no PADL statement.

Any ideas? Or do I just need to have a cuppa coffee before I start doing too much thinking first thing in the morning? <g>

TIA,
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Next
Reply
Map
View

Click here to load this message in the networking platform