List:General Discussion« Previous MessageNext Message »
From:John Daisley Date:October 15 2009 3:54pm
Subject:RE: Inserting csv
View as plain text  
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 john@stripped

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 <biz@stripped>
Sent: 15 October 2009 16:26
To: [MySQL] <mysql@stripped>
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=1


Thread
Inserting csvPatrice Olivier-Wilson15 Oct
  • Re: Inserting csvMichael Dykman15 Oct
RE: Inserting csvJohn Daisley15 Oct