我正在尝试内联上传存储在UTF-8文本文件中的数据,我有两个问题.首先,此表上当前没有设置主键,并且此时未将其设置为自动递增或强制为空;加载所有数据后,第一列将成为预期的主键,并在该点添加外键.
我收到以下错误:
25 row(s) affected, 1 warning(s): 1366 Incorrect integer value: ‘1’ for column ‘idtable_file’ at row 1 Records: 25 Deleted: 0 Skipped: 0 Warnings: 1
当试图运行这个:
LOAD DATA LOCAL INFILE '/path' INTO TABLE sandr.table_file
columns terminated by ','
LINES terminated by '\n'
(idtable_file, owner_id, folder_id, @modified_date, @created_date, size, filename)
SET modified_date = STR_TO_DATE(@modified_date,'%d/%m/%Y %T'),
created_date = STR_TO_DATE(@created_date,'%d/%m/%Y %T')
在这张桌子上:
CREATE TABLE `table_file` (
`idtable_file` int(11) DEFAULT NULL,
`owner_id` int(11) DEFAULT NULL,
`folder_id` int(11) DEFAULT NULL,
`modified_date` datetime DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`size` int(11) DEFAULT NULL,
`filename` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
我做错了什么但是我刚刚开始使用MySQL,所以我在黑暗中刺伤了一下,有什么想法吗?另外,虽然上面的SQL查询在PowerShell中正常工作,但它只是这样:
LOAD DATA LOCAL INFILE '/path' INTO TABLE sandr.table_file
columns terminated by ','
LINES terminated by '\n'
它炸弹了:
Exception calling “ExecuteNonQuery” with “0” argument(s): “Fatal error encountered during command execution.”
如果我将调整添加到日期字段.