I think it is comma delimited, and text is apparently delimited with doublequote. The clientdata.csv file contains 2593 lines, and 570 records. I can load the file into OpenOffice without a problem. I think the problem is that the text blurbs contain more than one line, and MySQL is parsing the file as if each new line would correspond to one databazse row. Records: 2023 Deleted: 0 Skipped: 0 Warnings: 198256 Query OK, 2023 rows affected, 65535 warnings (0.08 sec) I tried to load data into the file: LOAD DATA INFILE '/home/paul/clientdata.csv' INTO TABLE CSVImport No constraints are on the table, and all the fields hold VARCHAR(256) values, except the columns which contain counts (represented by INT), yes/no (represented by BIT), prices (represented by DECIMAL), and text blurbs (represented by TEXT). The CSV contains 99 columns, so this was a hard enough task in itself: CREATE TABLE 'CSVImport' (id INT) ĪLTER TABLE CSVImport ADD COLUMN Title VARCHAR(256) ĪLTER TABLE CSVImport ADD COLUMN Company VARCHAR(256) ĪLTER TABLE CSVImport ADD COLUMN NumTickets VARCHAR(256) ĪLTER TABLE CSVImport Date49 ADD COLUMN Date49 VARCHAR(256) ĪLTER TABLE CSVImport Date50 ADD COLUMN Date50 VARCHAR(256) I created a table called 'CSVImport' that has one field for every column of the CSV file. I have an unnormalized events-diary CSV from a client that I'm trying to load into a MySQL table so that I can refactor into a sane format.
0 Comments
Leave a Reply. |