| 
	
 | 
 Posted by Steve on 02/06/07 22:27 
On Feb 6, 10:25 am, "Paul" <paulwragg2...@hotmail.com> wrote: 
> 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 
 
An empty string has a DATALENGTH of 0 and is not NULL
 
  
Navigation:
[Reply to this message] 
 |