0

我正在尝试将一个以 UCS2-Big Indian 编码的大 csv 文件导入 mysql 表。

这是mysql代码:

DROP TABLE if exists PAPERS; 

CREATE TABLE `PAPERS` (
ID_RESEARCHER VARCHAR(20),
PAPER_ACCESSOR_NUMBER VARCHAR(20),
  primary key(ID_RESEARCHER,PAPER_ACCESSOR_NUMBER)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2;

load data local infile '...dump_all_papers_test_2.csv' 
into table PAPERS
CHARACTER SET ucs2
fields terminated by '\t' enclosed by '"'
lines terminated by '\n' 
(ID_RESEARCHER, PAPER_ACCESSOR_NUMBER);

以及csv的内容(格式ucs-2大印,notepad++表示)

"100"   "A1974U626600001"
"100"   "A1974U626600001"
"100"   "A1974U626600001"

csv样本的副本:

http://pastebin.com/HMssuxCf

错误是:

1 row(s) affected, 2 warning(s):
1265 Data truncated for column 'ID_RESEARCHER' at row 1
1261 Row 1 doesn't contain data for all columns
Records: 1  Deleted: 0  Skipped: 0  Warnings: 2

这里发生了什么?

该操作仅填充第一个字段。是不是mysql支持ucs2?

4

1 回答 1

0

好的。

解决方案在文档中:

请注意,目前无法加载使用 ucs2 字符集的数据文件。

http://dev.mysql.com/doc/refman/5.0/en/load-data.html

于 2012-07-23T09:36:19.493 回答