0
我想將CSV文件導入MySQL 5.1數據庫。MySQLIMPORT十六進制值
用於創建表的腳本是:
CREATE TABLE `session_hdr` (
`id` bigint(20) unsigned NOT NULL,
`type` smallint(5) unsigned NOT NULL,
`session_start_time` decimal(20,8) unsigned DEFAULT NULL,
`session_end_time` decimal(20,8) unsigned DEFAULT NULL,
`session_last_update_time` decimal(20,8) unsigned DEFAULT NULL,
`session_flag` tinyint(3) unsigned DEFAULT NULL,
`version` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1$$
這是我tyring導入到session_hdr表中的數據:
0X10004299300,1,7,1324542626.182691780,0.0,1324542627.76399180,1,3
0X1000429BF00,1,7,1324542656.188777040,0.0,1324542657.136454760,1,3
0X1000429CB00,1,7,1324542663.269024060,0.0,1324542663.292035400,1,3
0X1000429F200,1,7,1324542686.177864720,0.0,1324542687.45881600,1,3
0X100042A4000,1,7,1324542716.178234960,0.0,1324542717.645671220,1,3
0X100042A6800,1,7,1324542746.173958660,0.0,1324542747.66159900,1,3
....
我使用的命令是導入是:
mysqlimport --ignore-lines=1 -c id,type,session_start_time,session_end_time,session_last_update_time,session_flag,version databaseName1 session_hdr.csv
當我執行該命令時,我承認以下消息:
mysqlimport: Error: 1265, Data truncated for column 'id' at row 1, when using table: session_hdr
有沒有人看到爲什麼上述命令會拋出該錯誤?
它不需要用小x的'0x'嗎? – 2011-12-22 21:50:28
@Pekka我將它改爲小寫x ...相同的結果。我也嘗試完全刪除十六進制,並從1開始遞增,但仍然沒有幫助。 – Dave 2011-12-22 22:03:58