Jump to content

null (not asigned) values


voodoochicken

Recommended Posts

hi, according to some previous post, i could compare a field against a null value. i tried a select with a null value and it failed. something like select etc where some_field=null, some_field defined as int. it did not throw error, but the select failed. right now i can use -1 as null value, since the field i am trying to compare can not take negative values so i can use negative values as reference, but for future reference, how do you compare against a null value, and can you nullify a value that has been already assigned?

Link to comment
Share on other sites

Yes, you can set values to null the same way you do with any other value. Null is just a special value, but in MySQL you can use it like any other value. In MSSQL you need to use some functions to compare it and things like that. The select might be failing because the column doesn't contain any null values.

Link to comment
Share on other sites

Also, INT fields with NOT NULL can't be set to null. New rows will be added with value 0.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...