Incorrect decimal (integer) value: ' ' mySQL -


in mysql workbench database, 1 of tables has latitude, longitude , district attributes

lat: decimal (10,8)

lng: decimal (11,8)

district: int(4)

i'm trying import data .csv file table

error 1366: 1366: incorrect decimal value: '' column 'lat' @ row 1 sql statement: error 1366: 1366: incorrect integer value: '' column 'district' @ row 1 sql statement: insert `db`.`mytable` (`id`, `name_en`, `icon`, `lat`, `lng`, `district`, `city`, `postal_code`)     values ('686', 'name',?, '', '', '','1', 'p.o. box 1111') 

you have strict sql mode enabled, , try pass empty string ('') value decimal fields in insert. empty string invalid value numeric field , in strict sql mode mysql generates error if try insert invalid data column, rather providing warning , use default value (0 numeric columns) of particular column's data type:

strict mode controls how mysql handles invalid or missing values in data-change statements such insert or update. value can invalid several reasons. example, might have wrong data type column, or might out of range. value missing when new row inserted not contain value non-null column has no explicit default clause in definition. (for null column, null inserted if value missing.) strict mode affects ddl statements such create table.

if strict mode not in effect, mysql inserts adjusted values invalid or missing values , produces warnings (see section 13.7.5.40, “show warnings syntax”). in strict mode, can produce behavior using insert ignore or update ignore.

remove strict sql mode session before starting import:

set session sql_mode = '' 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -