Quote:
Originally Posted by felgall
Once you move out of the database null has a completely different meaning and two fields set to null are equal.
|
NOT TRUE AT ALL!
That may be true in PHP and JavaScript, but it is *NOT* true in some computer languages.
This is a table of the comparison operators from VBScript, just for example:
http://msdn.microsoft.com/en-us/libr...(v=vs.84).aspx
VB and VB.NET are essentially the same: They use the "IS" operator for testing object equality, and two nulls will not match using anything except the IS operator. Pascal, in most variations I've seen, is the same.
Only languages that don't seem to have a built in "isNull" or equivalent function/operator seem to treat a pair of nulls as being equal. It *IS* misleading to say that a pair of nulls are equal, for the reason Felgall gave: NULL means "unknown" and how can you know that a pair of unknowns are equal. I think this is a case where VB/VB.NET/VBScript do it better than JavaScript, C, C++, et al. If nothing else, how does it make sense to ask
Code:
if ( a <= null )
or
if ( b > null )
??? Clearly, those are nonsense questions. But stupid JavaScript, in these conditions, treats
null the same as zero. UGH! I think that's uglier than pig snot.