Reputation: 4163
I am trying to import a .txt
file that is in CSV format using phpmyadmin. It is a ZipCode database of the United States. When I select the import option and then load the file everything gets inserted successfully except for the ZipCodes that start with a 0
It will not add the 0
's so for example ZipCode 00601
gets added as 601
, 01234
gets added as 1234
. Has anyone experienced this before or know a way to prevent this? I have included a snippet of the .txt
file below.
Snippet:
"00601","+18.165273","-066.722583","ADJUNTAS","PR","ADJUNTAS","STANDARD"
"00602","+18.393103","-067.180953","AGUADA","PR","AGUADA","STANDARD"
"00603","+18.455913","-067.145780","AGUADILLA","PR","AGUADILLA","STANDARD"
"00604","+18.493520","-067.135883","AGUADILLA","PR","AGUADILLA","STANDARD"
Upvotes: 0
Views: 93
Reputation: 1349
You probably have the ZipCode data type as Integer and that is why the lead zeroes are omitted. Change the ZipCode data type to char(5) as answered here: Mysql Datatype for US Zip (Postal Codes)
Upvotes: 1