mysql - Getting error "1366 Incorrect integer value: '1'" when importing file -


i'm trying inline upload data stored in utf-8 text files, , have 2 problems. firstly, there's no primary key set on table, , it's not set auto-increment or forced null @ point; first column intended primary key once data loaded, , foreign keys added @ point.

i received following error:

25 row(s) affected, 1 warning(s): 1366 incorrect integer value: '1' column 'idtable_file' @ row 1 records: 25 deleted: 0 skipped: 0 warnings: 1

when trying run this:

load data local infile '/path' table sandr.table_file  columns terminated ','    lines terminated '\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') 

on table:

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 

i'm doing wrong i've started mysql i'm stabbing in dark fair bit, ideas on that? also, though above sql query works fine in powershell when it's this:

load data local infile '/path' table sandr.table_file  columns terminated ','    lines terminated '\n' 

it bombs out with:

exception calling "executenonquery" "0" argument(s): "fatal error encountered during command execution."

if add adjustment date fields.

25 row(s) affected, 1 warning(s): 1366 incorrect integer value: '1' column 'idtable_file' @ row 1 records: 25 deleted: 0 skipped: 0 warnings: 1

i have encountered error. thing note that

  • the error apparently absurd (it seems "1", integer, incorrect integer value), and
  • it happens on the first column of first row , only there.

if these 2 conditions hold, in probability culprit hidden three-byte sequence smack @ beginning of sql file you're trying load (it's called utf8 byte-order mark).

in cases sequence escaped in error message , shown recognizably, example in bug report. in other cases sent user part of value:

incorrect integer value: '###1'  ... 

but terminal "eats" bom , see (now absurd) error

incorrect integer value: '1' ... 

to solve problem, need open file imported in editor capable of removing byte order mark (e.g. notepad++).


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -