我正在尝试导入CSV并最近一直遇到错误:
ERROR: invalid input syntax for integer: ""
CONTEXT: COPY locations, line 1, column ext: ""
我还是新手,但据我所知,似乎没有对任何空白整数列使用null
。任何帮助,将不胜感激。
以下是CSV中的几行:
1 STOP ELECTRONICS CENTER,1100 CONEY ISLAND AVENUE,BROOKLYN,NY,11230,USA,7182491201,,,,
1 STOP FURNITURE WAREHOUSE,9050 KENMAR DR.,SAN DIEGO,CA,92121,USA,8582719400,,,,
309 OFFICE FURNITURE,1711 BETHLEHEM PARK,HATFIELD,PA,19440,USA,2158223333,,,,
"A & W OFFICE SUPPLY & DESIGN, INC.",10653 DUTCHTOWN ROAD,KNOXVILLE,TN,37932,USA,8656758532,,,,
这是我正在使用的COPY命令:
COPY locations(name, address, city, province, postal_code, country, phone, ext, phone_alt, ext_alt, url) FROM '/Volumes/Data/Users/me/Dealers.csv' WITH (FORMAT csv, DELIMITER ',', NULL 'NULL');
这是我的位置表:
Table "public.locations"
Column | Type | Modifiers
-------------+-----------------------------+--------------------------------------------------------
id | integer | not null default nextval('locations_id_seq'::regclass)
name | character varying(255) |
address | character varying(255) |
city | character varying(255) |
province | character varying(255) |
postal_code | character varying(255) |
country | character varying(255) |
phone | bigint |
ext | bigint |
phone_alt | bigint |
ext_alt | bigint |
latitude | double precision |
longitude | double precision |
created_at | timestamp without time zone | not null
updated_at | timestamp without time zone | not null
url | character varying(255) |
Indexes:
"locations_pkey" PRIMARY KEY, btree (id)
答案 0 :(得分:0)
尝试没有'NULL'
COPY位置(姓名,地址,城市,省份,邮政编码,国家,电话,分机,电话号码,分机号码,电话号码,网址)来自'/Volumes/Data/Users/me/Dealers.csv'WITH(FORMAT csv); < / p>