November 22, 2006 at 1:00 pm
I have a query that is looking at two dates, Case when Date A > Date B, Date A, Else B. This works fine as long as one is not null, I have tweaked my case statement to fix this, that was simple enough, what I would like to know is why does SQL not understand toss out the null date and default to the non null date?
November 22, 2006 at 1:06 pm
Because NULL is not equal to 1900/01/01. NULL is not even equal to NULL.
May I suggest a default value of the parameter in the proc? That would simplify the case statement a bit.
November 22, 2006 at 2:24 pm
Basically, NULL means 'I don't know what this value is'. If you don't know what the value is, how can you compare it (, =, =>, =<, etc) to another value?
-SQLBill
November 24, 2006 at 4:27 pm
And, you still need to determine.... is null a date way back in the past or a date in the future?
--Jeff Moden
Change is inevitable... Change for the better is not.
November 25, 2006 at 7:29 am
Exactly the point of a NULL. We don't know the information.
Now we could get started on the fact that we could know that this information does not exists but that's another story .
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply