Re: Insert Null values into field
If a column is set to NOT NULL in mysql, then that simply means that you cannot have a Null value in that column.
You could put ‘’ which is an empty string but you can’t actually put Null.
If the column is set to NULL, then you can have it’s value set to Null just fine.
I do have Address2 column set as NULL in the database, if that was not true I could not put a Null value in it.
Scott, You probably have a Default of ‘’ set on that column in your database, so if you don’t insert anything it then defaults to an empty string. If you set your charfield as NULL and remove the default, if you don’t put a value when you do the insert, it will have a Null value.
Correction/Clarification: If you have a field that is NOT NULL, and you don’t give a value nor do you have a default, the row will still insert (though it will raise a MySQL warning), and it will have an empty string, but this doesn’t help me because my column is definitely allowing Nulls