You are here: Re: NULLS and '' « MsSQL Server « IT news, forums, messages
Re: NULLS and ''

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация