Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MySQL 1262 Error

Posted on 2014-07-23
4
Medium Priority
?
2,269 Views
Last Modified: 2014-07-25
Hi,

I get this error when I import a CSV.

Warning (1262): Row 1 was truncated; it contained more data than there were input columns */

See attached screenshot for row 1

See attached screenshot of my Structure

Also, what is the best collation to use?
Row-1.png
Structure.png
0
Comment
Question by:Computer Guy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 2000 total points
ID: 40214785
What is the delimiter set to? If it were a space that would cause the problem. If it is a comma, why don't you show part of the CSV?  If the fields have spaces longer than 50 they could be truncating inside, but it sounds like it is getting more columns that in your database which leads me to suspect the delimiter is a space.

Sample below from link below that.
LOAD DATA LOCAL INFILE '/importfile.csv'
INTO TABLE test_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(field1, filed2, field3); 

Open in new window

(source: http://support.modwest.com/content/6/253/en/how-do-i-import-delimited-data-into-mysql.html)
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 40214816
Enya,A Day Without Rain,Processional Songs

See screen shot of how I import it.
data.png
0
 
LVL 25

Expert Comment

by:SStory
ID: 40215182
I wonder if the AUTO_INCREMENT column is throwing you off.
Does it work if there is an ID in front of each.
1,text,text,text

Test that. If so you somehow need to ignore the first field. Some one on the web suggested putting @dummy as field 1 so it will get ignored. I haven't tried that.

Or if you do it my way from the TSQL line and name your fields, skipping the ID field (field 1) it may work that way.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40219562
Do you have PHP available?  If so, PHP can read the CSV file into an array with fgetcsv(), allowing for a variety of field delimiters.  The PHP code to take these arrays and create INSERT queries is pretty standard stuff.
0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question