mysql用load导入数据时没有完全正确提示: Data truncated for column 'cno' at row 1
时间:2011-07-02
来源:互联网
//data.txt为:
"0001","大学英语","1001","12",
"0002","高等数学","1002","6",
"0003","马克思主义哲学","1003","2",
"0004","邓小平理论","1004","2",
用load语句导入到course表中出现了下面的状况:
mysql> select * from course;
+------+-----------------------+------+---------+
| cno | cname | cpno | ccredit |
+------+-----------------------+------+---------+
| " | 大学英语 | 1001 | 12 |
| 0002 | 高等数学 | 1002 | 6 |
| 0003 | 马克思主义哲学 | 1003 | 2 |
| 0004 | 邓小平理论 | 1004 | 2 |
+------+-----------------------+------+---------+
4 rows in set (0.00 sec)
我建立的course表结构是这样的:
mysql> create table course
-> (
-> cno char(4) primary key,
-> cname char(40),
-> cpno char(4),
-> ccredit smallint
-> );
Query OK, 0 rows affected (0.14 sec)
不知道,为什么第一行的cno会变成 " ?warning 信息是:
| Warning | 1265 | Data truncated for column 'cno' at row 1 |
| Warning | 1262 | Row 1 was truncated; it contained more data than there were input columns |
| Warning | 1262 | Row 2 was truncated; it contained more data than there were input columns |
| Warning | 1262 | Row 3 was truncated; it contained more data than there were input columns |
+---------+------+---------------------------------------------------------------------------+
4 rows in set (0.00 sec)
"0001","大学英语","1001","12",
"0002","高等数学","1002","6",
"0003","马克思主义哲学","1003","2",
"0004","邓小平理论","1004","2",
用load语句导入到course表中出现了下面的状况:
mysql> select * from course;
+------+-----------------------+------+---------+
| cno | cname | cpno | ccredit |
+------+-----------------------+------+---------+
| " | 大学英语 | 1001 | 12 |
| 0002 | 高等数学 | 1002 | 6 |
| 0003 | 马克思主义哲学 | 1003 | 2 |
| 0004 | 邓小平理论 | 1004 | 2 |
+------+-----------------------+------+---------+
4 rows in set (0.00 sec)
我建立的course表结构是这样的:
mysql> create table course
-> (
-> cno char(4) primary key,
-> cname char(40),
-> cpno char(4),
-> ccredit smallint
-> );
Query OK, 0 rows affected (0.14 sec)
不知道,为什么第一行的cno会变成 " ?warning 信息是:
| Warning | 1265 | Data truncated for column 'cno' at row 1 |
| Warning | 1262 | Row 1 was truncated; it contained more data than there were input columns |
| Warning | 1262 | Row 2 was truncated; it contained more data than there were input columns |
| Warning | 1262 | Row 3 was truncated; it contained more data than there were input columns |
+---------+------+---------------------------------------------------------------------------+
4 rows in set (0.00 sec)
作者: kuzuozhou 发布时间: 2011-07-02
LOAD语句是怎么写的? 另外把这个文件上传一下,是不是否什么特殊字符在其中,特别是以UTF格式保存的TXT文件。
作者: ACMAIN_CHM 发布时间: 2011-07-02
引用 1 楼 acmain_chm 的回复:
LOAD语句是怎么写的? 另外把这个文件上传一下,是不是否什么特殊字符在其中,特别是以UTF格式保存的TXT文件。
load语句是:LOAD语句是怎么写的? 另外把这个文件上传一下,是不是否什么特殊字符在其中,特别是以UTF格式保存的TXT文件。
load data local infile '/home/kuzuozhou/桌面/data.txt' into table course fields terminated by ',' enclosed by '"' lines terminated by '\n';
UTF格式我注意了啊。。
作者: kuzuozhou 发布时间: 2011-07-02
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28