Reply to Re: VALUE IN FIELD NULL OR VOID STRING!?

Your name:

Reply:


Posted by Simon Hayes on 05/25/05 20:38

"Peter Neumaier" <Peter.Neumaier@gmail.com> wrote in message
news:1117035863.712637.185370@z14g2000cwz.googlegroups.com...
> Hi!
>
> I got a column, with different dates in it (Ddata type "nvarchar")...
> when running a SELECT on this column, I'm trying to filter those
> recordsets out, WHERE this column is NULL (I checked the table, there
> are "empty" fields in the column):
> "SELECT bla FROM bla WHERE myColumn NOT NULL"
> but I still receive those "empty" fields in my resultset ...
> so I tried it with:
> SELECT bla FROM bla WHERE myColumn <> ''
> again, "empty" fields in my resultset ....
>
> what's going wrong there? is there a possibility to check what kind of
> value I got in my column!?
>
> Thanks!
> Peter
>

As a guess, you want this:

select *
from dbo.MyTable
where coalesce(SomeColumn, '') <> ''

See COALESCE() and ISNULL() in Books Online. If this doesn't help, I suggest
you post an example of the 'empty' data - is it empty strings, a number of
spaces etc. You can use LEN(), DATALENGTH(), ASCII() etc to help identify
the data.

You should also change the column data type to datetime, not nvarchar, as
that will help prevent invalid data (eg empty strings) and also allow you to
use datetime functions like DATETIME and DATEADD more easily.

Simon

[Back to original 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

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