Results 1 to 4 of 4
Feb 6, 2009, 05:13 #1
- Join Date
- Jul 2003
- Newcastle upon Tyne
- 0 Post(s)
- 0 Thread(s)
MySQL LOAD DATA INFILE is missing columns
I'm testing a small sample of a CSV file to be uploaded into MySQL.
However the LOAD DATA INFILE command is missing the first column and I don't know how to get it in.
It always puts my second column from CSV into the first column.
Here is the database;
; Pseduocode Database id (primary key, auto_increment, int) OfferProcessType (var 32) TradingName (var 32)
OfferProcessType,TradingName E, A,My Travel
LOAD DATA INFILE 'testy.csv' INTO TABLE `testy` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' ;
1. For some reason this call does not pull in my first column. How do I get it to read the first column and put it into the database?
2. How do I ensure that the columns in the CSV file are the same as those in MySQL?
3. How do I make sure MySQL does not import the column names, or any blank rows (in my example the second row is empty).
I am currently adding this line: "IGNORE 2 LINES;" into my MySQL call.
This removes the first 2 rows, but I don't know if this is the right way to do it.