Hi,
i have two db mysql with the same table.
I export the result query from first db with the function Export grid data to file... and save the file csv
Import on the second db the file csv just create with the function Import CSV file... but i receive this error
No rows were imported. This can have several causes:
-File is empty
-Wrong file encoding was selected or detected
-Field and/or line terminator do not fit to the file contents
Help me
Export - Import csv
the file not is empty and the fist line are:
"field1";"field2";"field3";"field4";"field5"
"1469164";"1109";"35";"126;295;332;241;575;527;635;675;836;838;826;153;300;344;828;834;621;706";"341"
"1469165";"53116";"35";"102;295;226;334;672;687;659;719;838;826;914;107;916;610;501;258;359;917";"340"
"1469166";"16228";"35";"101;353;332;233;635;697;702;545;826;895;865;103;874;870;570;560;231;360";"123"
"field1";"field2";"field3";"field4";"field5"
"1469164";"1109";"35";"126;295;332;241;575;527;635;675;836;838;826;153;300;344;828;834;621;706";"341"
"1469165";"53116";"35";"102;295;226;334;672;687;659;719;838;826;914;107;916;610;501;258;359;917";"340"
"1469166";"16228";"35";"101;353;332;233;635;697;702;545;826;895;865;103;874;870;570;560;231;360";"123"
Ok, looks good so far. Now, what control characters did you put into the import dialog - or, if you didn't touch them, which were they? Your output expects a semicolon as separator, double quotes as encloser and windows linebreak as line terminator. If you get the above warning I guess these were not set?
When I try this this with (comma separated, double quote) still get this error irrespective of linebreak format
LOAD DATA LOCAL INFILE 'C:\\Users\\User\\UK_Statistical_Geographies\\Postcode\\Postcodes_(Enumeration)_(2011)_to_output_areas_(2011)_to_lower_layer_SOA_(2011)_to_middle_layer_SOA_(2011)_to_local_authority_districts_(2011)\\PCD11_OA11_LSOA11_MSOA11_LAD11_EW_LU.csv' REPLACE INTO TABLE "public"."pcd11_oa11_lsoa11_msoa11_lad11_ew_lu" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ("pcd7", "pcd8", "oa11cd", "lsoa11cd", "lsoa11nm", "msoa11cd", "msoa11nm", "lad11cd", "lad11nm", "lad11nmw", "pcdoasplt");
/* ERROR: syntax error at or near "DATA"
LINE 1: LOAD DATA LOCAL INFILE 'C:\\Users\\User\\UK_Statistical_Geog...
^ */
LOAD DATA LOCAL INFILE 'C:\\Users\\User\\UK_Statistical_Geographies\\Postcode\\Postcodes_(Enumeration)_(2011)_to_output_areas_(2011)_to_lower_layer_SOA_(2011)_to_middle_layer_SOA_(2011)_to_local_authority_districts_(2011)\\PCD11_OA11_LSOA11_MSOA11_LAD11_EW_LU.csv' REPLACE INTO TABLE "public"."pcd11_oa11_lsoa11_msoa11_lad11_ew_lu" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES ("pcd7", "pcd8", "oa11cd", "lsoa11cd", "lsoa11nm", "msoa11cd", "msoa11nm", "lad11cd", "lad11nm", "lad11nmw", "pcdoasplt");
/* ERROR: syntax error at or near "DATA"
LINE 1: LOAD DATA LOCAL INFILE 'C:\\Users\\User\\UK_Statistical_Geog...
^ */
"load data" is mysql only. postgresql doesn't have it (LOAD only loads plugins there); use COPY instead.
that would be COPY FROM STDIN ...; the docs state "STDIN: Specifies that input comes from the client application". Its is however not clear to me how the application is supposed to provide the data. This and this are related; in short, the client must use libpq.PQputCopyData() and .PQputCopyEnd() to transfer the data to be COPYed to the server, the only point still missing is how to determine when to start calling these functions; this seems to indicate that no event/callback is necessary, but you can start calling PQputCopyData() as soon as PQExec(..,'COPY FROM STDIN...') is done and PQresultStatus() returns PGRES_COPY_IN.
Please login to leave a reply, or register at first.