0

So I have created a table with several date values of which one column is not mandatory, meaning it may go with null value. In the table structure, I have set "NULL" as "YES" and "DEFAULT" as "NULL" but every time I try to make an entry with NULL value in the column, it throws error : Incorrect date value: '' for column my_column at row 1. Although when I am entering any date for this column instead of null, the values are inserted successfully.

Anna
  • 1
  • 2
    An empty string is not `NULL`. – Barmar Nov 16 '21 at 06:07
  • But it works for the other columns. I was facing same issue with columns with value types text and varchar and the issue was resolved upon setting NULL as yes and DEFAULT as null – Anna Nov 16 '21 at 06:33
  • 1
    An empty string is a valid value for a VARCHAR, but not for a date. – Barmar Nov 16 '21 at 06:35
  • Oh Okay!! Thank you!! I tried sending NULL when ' ' is received in input and it works! – Anna Nov 16 '21 at 06:46

0 Answers0