简体   繁体   English

LOAD DATA INFILE 错误:#1265 - 第 1 行的 X 列数据被截断

[英]LOAD DATA INFILE error: #1265 - Data truncated for column X at row 1

Using the following query:使用以下查询:

LOAD DATA INFILE 'Path/OfFile'
INTO TABLE sample
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(file_path, name, size, length, pack_id);

The following error is generated:生成以下错误:

#1265 - Data truncated for column 'length' at row 1 #1265 - 在第 1 行截断列“长度”的数据

The first row (apparently the source of the error) of the CSV File (not including the ignored line) is: CSV 文件的第一行(显然是错误的来源)(不包括被忽略的行)是:

"C:\Path","Filename.wav","2230852","8","1" "C:\Path","文件名.wav","2230852","8","1"

The "8" corresponds to the "length" field that is being complained about... what could be being truncated? “8”对应于被抱怨的“长度”字段......可能会被截断什么?

Is there an error in the CSV or Query? CSV 或 Query 是否有错误?

Note: 'file_path' and 'name' are type VARCHAR(256) 'size' is type BIGINT UNSIGNED 'length' and 'pack_id' are type INTEGER UNSIGNED注意:'file_path' 和 'name' 是 VARCHAR(256) 类型 'size' 是 BIGINT UNSIGNED 类型 'length' 和 'pack_id' 是 INTEGER UNSIGNED 类型

After many hours of searching and trial-and-error, it was discovered that the problem was the file paths (from a windows machine) were stored with backslashes instead of forward ones, resulting in the confounding error message.经过数小时的搜索和反复试验,发现问题在于文件路径(来自 windows 机器)以反斜杠而不是正斜杠存储,导致混淆错误消息。

Hopefully someone can benefit from the turmoil and anguish:)希望有人能从动荡和痛苦中受益:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM