Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
markw
Starting Member
1 Post |
Posted - 2004-10-12 : 11:40:22
|
| Hello,Dutch zipcodes are like '3448HP'If you want to check on a range of zipcodes you could do something like this:select * from ZipCode where ('1339YM' BETWEEN pc1 AND pc2) It works great!But how does SQL Server knows that '1339YM' is before '1339YQ' for instance?Can somebody clarify the inner working? |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2004-10-12 : 12:16:44
|
| Shrug, it's a string. For most collations, digits collate in 0123456789 order immediately before letters.It won't work if there are codes with different numbers of digits, but I've no idea if this is possible for Dutch zip codes. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-10-12 : 12:48:11
|
| I'm not seeing the problem...How does it know 'A' is before 'B'?Brett8-) |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-10-12 : 23:03:24
|
| my guess, it converts the characters to numeric equivalent (char fn), then adds the numbers up? so A is 65 and B is 66--------------------keeping it simple... |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-10-12 : 23:38:50
|
the original post said "it worked great", I think they just want to understand why it works...if you think of letters as two digits, the look likeA - 65B - 66etc...so your zipcode comparisons would look like:1339YM - 133989771339YQ - 1339898113398977 is less than 13398981 Corey |
 |
|
|
|
|
|