首頁  >  文章  >  資料庫  >  lines-在mysql 中怎么把文件里的内容写到表中啊!!!!!

lines-在mysql 中怎么把文件里的内容写到表中啊!!!!!

WBOY
WBOY原創
2016-06-06 09:36:561206瀏覽

mysqllines

文本内容

1,"zhangsan","f"
2,"lisi","m"
3,"zhaoliu","f"
建表
create table mytable(
id int(20),
name varchar(20),
gender char(1)
);
把文本内容写到表中
load data infile 'f:b.txt' replace into table mytable
fields terminated by ',' enclosed by '"'
lines terminated by '\n'(id,name,gender);

mysql> load data infile 'f:b.txt' replace into table mytable
-> fields terminated by ',' enclosed by '"'
-> lines terminated by '\n'(id,name,gender);
ERROR 1406 (22001): Data too long for column 'gender' at row 1
怎么把文件里的内容写到表中啊!!!!!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn