'SQL insert into select Error: SQLSTATE[HY000]: General error: 1364 Field '' doesn't have a default value

I have a table that contains idCourse, idCoureur, time1, time2, time3 and I would like to insert a new line.

INSERT INTO  chrono (idCourse, idCoureur)
SELECT  idCourse, idCoureur
FROM     dossard 

I want time1, time2, time3 to be null, but I get an error message because time1, time2, time3 don't have values. How do I fix that?

SQLSTATE[HY000]: General error: 1364 Field '' doesn't have a default value



Solution 1:[1]

set the column as nullable. Maybe you set NOT NULL when you created.

ALTER TABLE chrono ALTER COLUMN [time1] SMALLDATETIME NULL

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dúver Cruz