I have a problem on this error message, when i try this:
INSERT INTO `PROGETTO`.`UFFICIO-INFORMAZIONI` (`ID`, `viale`, `num_civico`,
`data_apertura`, `data
Also check your triggers.
Encountered this with a history table trigger which tried to insert the main table id
into the history table id
instead of the correct hist-table
.source_id
column.
The update statement did not touch the id
column at all so took some time to find:
UPDATE source_table SET status = 0;
The trigger tried to do something similar to this:
FOR EACH ROW
BEGIN
INSERT INTO `history_table` (`action`,`id`,`status`,`time_created`)
VALUES('update', NEW.id, NEW.status, NEW.time_created);
END;
Was corrected to something like this:
FOR EACH ROW
BEGIN
INSERT INTO `history_table` (`action`,`source_id`,`status`,`time_created`)
VALUES('update', NEW.id, NEW.status, NEW.time_created);
END;
I just encountered the same issue but here it seemed to come from the fact that I declared the ID-column to be UNsigned and that in combination with an ID-value of '0' (zero) caused the import to fail...
So by changing the value of every ID (PK-column) that I'd declared '0' and every corresponding FK to the new value, my issue was solved.
If you are using PHPMyAdmin You can be solved this issue by doing this:
CAUTION: Don't use this solution if you want to maintain existing records in your table.
Step 1: Select database export method to custom:
Step 2: Please make sure to check truncate table before insert in data creation options:
Now you are able to import this database successfully.
When I get this kind of error I had to update the data type by a notch. For Example, if I have it as "tiny int" change it to "small int" ~ Nita
The problem is related with your file - you are trying to create a DB using a copy - at the top of your file you will find something like this:
CREATE DATABASE IF NOT EXISTS *THE_NAME_OF_YOUR_DB*
DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci;
USE *THE_NAME_OF_YOUR_DB*
;
and I'm sure that you already have a DB with this name - IN THE SAME SERVER - please check. Just change the name OR ERASE THIS LINE!
If you have a new database and you make a fresh clean import, the problem may come from inserting data that contains a '0' incrementation and this would transform to '1' with AUTO_INCREMENT
and cause this error.
My solution was to use in the sql import file.
SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO';