Subject | padding in char field??? |
---|---|
Author | kyle@nevadacitysoftware.com |
Post date | 2001-05-31T05:57:32Z |
Hello,
I set up a column in a zip code table as char(7) so I could store both 7-
char Canadian and 5-char US postal codes.
But now I cannot query the 5char zip codes. For example
select * from MyTable where ZipCode='99502'
produces no result. Yet the row is clearly in the table.
I can do this:
select * from MyTable where ZipCode>'99501' and ZipCode<'99503'
and I will get the row
What is the 7 char field padded with, and how can I do an equality query
against these zipcodes? I have tried with simple space pads ('99502 '),
and that doesn't work.
Thanks,
Kyle
http://pearz.com - A new whole-person approach to online dating
I set up a column in a zip code table as char(7) so I could store both 7-
char Canadian and 5-char US postal codes.
But now I cannot query the 5char zip codes. For example
select * from MyTable where ZipCode='99502'
produces no result. Yet the row is clearly in the table.
I can do this:
select * from MyTable where ZipCode>'99501' and ZipCode<'99503'
and I will get the row
What is the 7 char field padded with, and how can I do an equality query
against these zipcodes? I have tried with simple space pads ('99502 '),
and that doesn't work.
Thanks,
Kyle
http://pearz.com - A new whole-person approach to online dating