我正在尝试使用phpmyadmin导入CSV格式的.txt
文件。它是美国的ZipCode数据库。当我选择导入选项然后加载文件时,除了以0
开头的ZipCodes之外,所有内容都会成功插入。它不会添加0
所以例如ZipCode 00601
获取添加为601
,01234
添加为1234
。有没有人以前经历过这种情况或知道预防这种情况的方法?我在下面添加了.txt
文件的片段。
段:
"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"
答案 0 :(得分:1)
您可能将ZipCode数据类型设置为Integer,这就是省略前导零的原因。将ZipCode数据类型更改为char(5),如下所示: Mysql Datatype for US Zip (Postal Codes)