0

我正在尝试.txt使用 phpmyadmin 导入 CSV 格式的文件。它是美国的邮政编码数据库。当我选择导入选项然后加载文件时,除了以 a 开头的 ZipCode 之外,所有内容都已成功插入0它不会添加0',因此例如 ZipCode00601被添加为60101234被添加为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"
4

1 回答 1

1

您可能将 ZipCode 数据类型设为 Integer,这就是省略前导零的原因。将 ZipCode 数据类型更改为 char(5),如下所示: Mysql Datatype for US Zip (Postal Codes)

于 2013-02-03T22:56:11.800 回答