0

Hi all,

I've problem with inserting data values from .csv file to MySQL data table.

My query as follows;

LOAD DATA INFILE 'C/Customers.csv'
INTO TABLE pc.customers
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(CustID, RegDate, CName, CAddress, CPhone1, CPhone2, Order_OrderID) 

It returns error msg as follows;
Error Code: 1406. Data too long for colum "CustID" at row 1.

FYI, my CustID datatype is varchar(255) and one of its data value is "C001". I'm using MySQL workbench.

Anyone pls help.. Thx

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by drjohn
0

My Table structure as follows;

CustID - varchar(255) PK, NN, UQ
RegDate - Date NN
CName - varchar(45) NN
CAddress - varchar(45) NN
CPhone1 - INT NN
CPhone2 - INT
Order_OrderID - varchar(45) NN

My Sample data values as follows;
CustID - C001
CName - Marly
CAddress - R. Sete de Setembro 54
CPhone1 - 89875477
CPhone2 -
Order_OrderID - O12365, O12375, O12376

Anyway, is it because of mysql server setting?

0

I've had data that had a ' in it a few times, and that caused me problems. I loaded the csv file into Excel, and saved it as text, tab delimited and the problem went away instantly. I've stuck to that method and delimiter ever since.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.