Getting the error "1366 Invalid integer value: '1'" when importing a file

I am trying to load data stored in UTF-8 text files and I have two problems. First, there is currently no primary key set in this table, and it does not set auto-increment or force null at this point; the first column will be the intended primary key after all data has been loaded, and foreign keys will be added to this point.

I got the following error:

25 rows, 1 warning (s): 1366 Invalid integer value: '1' for the column 'idtable_file' in row 1 Entries: 25 Deleted: 0 Missed: 0 Warnings: 1

when trying to accomplish this:

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')

in this 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

- , MySQL, , - ? , SQL- PowerShell, :

LOAD DATA LOCAL INFILE '/path' INTO TABLE sandr.table_file 
columns terminated by ','   
LINES terminated by '\n'

:

ExecuteNonQuery "0": " ".

.

+4
1

25 , 1 (): 1366 : '1' 'idtable_file' 1 : 25 : 0 : 0 : 1

. ,

  • , -, (, "1", , )
  • .

, , , , SQL, ( UTF8).

, . :

Incorrect integer value: '###1'  ...

"" , , , ( )

Incorrect integer value: '1' ...

, , - , (, Notepad ++).

+4

Source: https://habr.com/ru/post/1598937/


All Articles