Mysql error 1406

I created a database and am trying to load data from a csv spreadsheet file. There is no data in it yet. When i started

LOAD DATA INFILE 'docs.csv' INTO list FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (vendor, title, project, description, shelf); 

I get the message " ERROR 1406 (22001): Data is too large for the Provider column in row 1. " However, the provider record in line 1 is 6 characters long. I created the table as follows:

CREATE TABLE list (
    autonumber  SERIAL,
    vendor      varchar(50),
    title       varchar(100),
    project     varchar(100),
    description     text,
    shelf       smallint UNSIGNED,
PRIMARY KEY(autonumber));

There are many commas and carriage returns in the description column (Alt + Enter in the spreadsheet); am I using \ t correctly for the FIELDS TERMINATED command and carriage returns cause problems?

+5
source share
4 answers

value is too large for this column

try changing the value from 50 to 100 as this

     CREATE TABLE list (
     autonumber  SERIAL,
     vendor      varchar(100),
     title       varchar(100),
     project     varchar(100),
     description     text,
     shelf       smallint UNSIGNED,
    PRIMARY KEY(autonumber));
0
source

, , \n. , . , .

:

OPTIONALLY ENCLOSED BY '"' 
0

infile .

LOAD DATA INFILE 'docs.csv' INTO TABLE list

 FIELDS TERMINATED BY ',' 

 ENCLOSED BY '"' 

 LINES TERMINATED BY '\r\n' (vendor, title, project, description, shelf); 

, .

load data local infile 'c:/xampp/htdocs/example.csv'

     into table mytbl fields terminated by ','

     enclosed by '"'

     lines terminated by '\r\n' 

     ignore 1 lines (f_name,age,id);

, .

0

, csv , mysql, "ERROR 1406 (22001): 'vendor' 1.

, mysql GBK, csv UTF-8, .

, mysql.

0
source

All Articles