gpt4 book ai didi

MySQLIMPORT 十六进制值

转载 作者:行者123 更新时间:2023-11-29 14:37:55 25 4
gpt4 key购买 nike

我正在尝试将 CSV 文件导入 MySQL 5.1 数据库。

创建表的脚本是:

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$$

这是我试图导入到 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

有人知道为什么上面的命令会抛出该错误吗?

最佳答案

在您的数据中,第一个列的值不符合 int 类型,该类型只能包含数字。在导入之前,您需要将值从十六进制转换为整数。

关于MySQLIMPORT 十六进制值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8610071/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com