Thread: NULLS and ''
View Single Post

   
  #5 (permalink)  
Old 03-01-2008, 12:15 PM
Paul
 
Posts: n/a
Default Re: NULLS and ''

Thanks Plamen, I am just about to go home for the evening so I will
check this out tommorrow.

I just wanted to post an update before I go home though.

I have been looking a bit more in to this and I have found that the
following seems even stranger to me.

If I have a column DESCRIPTION VARCHAR(250) and the value is empty
i.e. NULL then
shouldn't doing a:

SELECT TAB1.DESCRIPTION
FROM TABLE1 TAB1
WHERE TAB1.DESCRIPTION IS NOT NULL
AND DATALENGTH(TAB1.DESCRIPTION) = 0

always return zero records?
A VARCHAR is variable length based on the actual data stored in it, so
shouldn't a VARCHAR column of zero DATALENGTH be NULL?

If anybody can explain this then please do!

I will be looking in to Plamens suggestion tommorrow but in the
meantime if anybody has any other ideas it will be appreciated!

Thanks,

Paul



Reply With Quote