tarsus
04-03-2007, 05:05 PM
I'm using MySQL 4.
I thought I understood that, if you have a default value specified for a field that cannot be null, using NULL in an insert query will result in that field receiving that default value.
I've always done this before. However, now I am receiving an error telling me the field cannot be null. The field most certainly has a default value set in the table.
On top of that, the reverse is true when I try my update queries. Using NULL works, but using DEFAULT results in an error. (But using NULL results in an entry of 0, not the default.)
If I can't use NULL in inserts or DEFAULT in updates, how do I even utilize the defaults I've set for required fields? I really should not have to assign these defaults in my server scripts when building the queries.
I thought I understood that, if you have a default value specified for a field that cannot be null, using NULL in an insert query will result in that field receiving that default value.
I've always done this before. However, now I am receiving an error telling me the field cannot be null. The field most certainly has a default value set in the table.
On top of that, the reverse is true when I try my update queries. Using NULL works, but using DEFAULT results in an error. (But using NULL results in an entry of 0, not the default.)
If I can't use NULL in inserts or DEFAULT in updates, how do I even utilize the defaults I've set for required fields? I really should not have to assign these defaults in my server scripts when building the queries.