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
Of course, this will involve you changing the length() if the ZipCode has
only 3 digits.
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: [email protected]
Subject: Leading zero where strlen < 5
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 Tel: 415.898.2602
<http://www.newgeo.com> Novato, CA U.S.A.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]