Those converters aren't all that great . I think its best to stay away from 
them. If a csv is too complex for a 'LOAD DATA INFILE' command then why not use 
an etl tool like talend to load the data?

Its easy to see where your converter has gone wrong but to 'fix' the query I'd 
need the table info. Run 'SHOW CREATE TABLE membership;' in the mysql client 
and post the result here.

If you could post a copy of the csv (if it does not contain anything 
sensitive), then myself or someone else on here could probably write you a 
'LOAD DATA INFILE' command to put the data into your database fairly quickly.

Regards

John Daisley
Mobile +44(0)7812 451238
Email j...@butterflysystems.co.uk

Certified MySQL 5 Database Administrator (CMDBA)
Certified MySQL 5 Developer
Cognos BI Developer

-----------------------
Sent from HP IPAQ mobile device.



-----Original Message-----
From: Patrice Olivier-Wilson <b...@biz-comm.com>
Sent: 15 October 2009 16:26
To: [MySQL] <mysql@lists.mysql.com>
Subject: Inserting csv

Newbie question, please.

I have a csv file of 950 records, 20 fields.

I used this converter
http://csv2sql.evandavey.com/

and copied/pasted insert code into SQL in phpMyAdmin

and got this error


SQL query:

INSERT INTO membership(  `members_ID` ,  `updated` ,  `notes` ,  
`preferred_mail_street` ,  `preferred_mail_csz` ,  `first_name` ,  
`last_name` ,  `street` ,  `city` ,  `state` ,  `zip` ,  `location_code` 
,  `property` ,  `camp_street` ,  `camp_city` ,  `camp_zip` , 
`member_year` ,  `director` ,  `email` ,  `camp_phone` ,  `20` ,  `21` 
,  `22` ,  `23` )
VALUES (

'',  '',  '',  '',  '',  'xxx',  'xxxx',  '102 Summer St',  
'Dover-Foxcroft',  'xx',  '04426',  'B',  'M15_L1_S20',  'Mill Brook',  
'Bowerbank',  '',  '',  '',  '',  '',  '',  '',  '',  ''
);

MySQL said:

#1054 - Unknown column '20' in 'field list'

Actually the first time, it was column 21, so to trouble shoot, I removed that 
column from csv file and field name in phpMyAdmin.


camp_phone should be the last field but 

 `20` ,  `21` ,  `22` ,  `23` ) 

is there too... 

Any assistance most appreciated!

I checked the file and didn't see any odd entries after the camp_phone field.





-- 
Patrice Olivier-Wilson
888-385-7217
http://biz-comm.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/mysql?unsub=john.dais...@butterflysystems.co.uk



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to