2012-07-23 60 views
0

我想導入一個大的CSV文件在UCS2-大印度編碼到MySQL表中。使用UCS2時編碼問題與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大的印度,由所述記事本++)

"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?

回答