> If this is so, IMNSHO it was a wrong decision:
> Zip codes are character strings, even though they may (in some / many
> countries) consist of digits only.
> Use a "char (n)" column for them, with "n" varying by country.
So did I, as in the char(n) however, the import script I wrote, in the
lang
Hi Scott, all!
Scott Haneda wrote:
I need to update a column, if the string length is less than 5, I want to
add leading zeros to it until it has 5. These are zip codes, I think there
are no 00 leading zips, so most should all be four chars long.
This sounds like the columns were of a numeri
> J.R. Bullington wrote:
>> The best way to do this is with code, however, here is A way to do it (I am
>> sure that there are more than one...)
>>
>> UPDATE tbl_Name SET ZipCodes = concat('0',ZipCodes) WHERE length(ZipCodes) =
>> 4
>>
> How about
>
> UPDATE tbl_Name SET ZipCodes = right(conca
J.R. Bullington wrote:
The best way to do this is with code, however, here is A way to do it (I am
sure that there are more than one...)
UPDATE tbl_Name SET ZipCodes = concat('0',ZipCodes) WHERE length(ZipCodes) =
4
How about
UPDATE tbl_Name SET ZipCodes = right(concat('0',ZipCodes), 5)
Also, of course, try this with a LIMIT to make sure that this updates your
fields correctly. I know it works on mine...
J.R.'s $0.02
-Original Message-
From: Scott Haneda [mailto:[EMAIL PROTECTED]
Sent: Monday, June 26, 2006 7:17 PM
To: mysql@lists.mysql.com
Subject: Leading zero wher
I need to update a column, if the string length is less than 5, I want to
add leading zeros to it until it has 5. These are zip codes, I think there
are no 00 leading zips, so most should all be four chars long.
--
-
Scott Haneda