Tag Archives: sql

MySQL drops leading zeroes from imported US zip codes

After importing a table from a csv import, MySQL drops the leading zero from those codes that contain it. A quick way to fox this is to use a SQL query to update the table. Log into the correct database in phpMyAdmin and open the table in question Choose the SQL option from the tabs at the top Paste the following query in to the box UPDATE table_name SET ZipCode = concat(‘0’,ZipCode) WHERE length(ZipCode) = 4 Modify the statement to fit your situation, including table…

Read MOre »