How can I import a csv file with varying numbers of values per row into postgres?

المشرف العام

Administrator
طاقم الإدارة
I am trying to import a csv file into postgres using this statement:

COPY T00_import FROM E'C:\\temp\\CSV\\Aberdeen City 9051_20150212_C_01.csv' CSV;The Table T00_import is a simple table with 17 fields, all set to varchar(100). The csv does not have a header and the first row only has 9 values, rows further down have up to 17 values (columns). Postgres is giving me this error:

ERROR: missing data for column "field10"CONTEXT: COPY t00_import, line 1: "10,"Aberdeen City Council",9051,2015-02-12,1,2015-02-12,111245,1.0,"C""********** Error **********ERROR: missing data for column "field10"SQL state: 22P04Context: COPY t00_import, line 1: "10,"Aberdeen City Council",9051,2015-02-12,1,2015-02-12,111245,1.0,"C""I have tried identifying the Null string but this did nothing. It should be easy to fix this, but I can't find how.

Many thanks for your help!



أكثر...
 
أعلى