//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)

解决方案 »

  1.   

    LOAD语句是怎么写的? 另外把这个文件上传一下,是不是否什么特殊字符在其中,特别是以UTF格式保存的TXT文件。
      

  2.   

    load语句是:
    load data local infile '/home/kuzuozhou/桌面/data.txt' into table course  fields terminated by ',' enclosed by '"' lines terminated by '\n';
    UTF格式我注意了啊。。
      

  3.   

    问题解决了。怎么解决的,这个我都说不清!我的data.txt原本是在windows下做的,保存时也存为UTF-8格式,然后考到linux里,我在linux里打开,另存为unix/linux风格。我想问题可能是格式不对早成的什么乱码吧。。谢谢ACMAIN_CHM。。
    问题解决了就结贴给分!
    这是我的风格!