473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

VALUE IN FIELD NULL OR VOID STRING!?

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

Jul 23 '05 #1
3 3720

Just try this way:

SELECT bla FROM bla WHERE myColumn NOT IS NULL
best Regards,
Chandra
http://groups.msn.com/SQLResource/
http://chanduas.blogspot.com/
---------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #2
you can also try as:
or
SELECT bla FROM bla WHERE ISNULL(myColumn,'')=''

best Regards,
Chandra
http://groups.msn.com/SQLResource/
http://chanduas.blogspot.com/
---------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #3

"Peter Neumaier" <Pe************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.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
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Robert Oschler | last post by:
I am converting a Perl script over to "C" for a potential open source project. I need some open source "C" code that will give me the same functionality of a Perl Style associative array: ...
3
by: Oberon | last post by:
How do I deal with this? I am getting an error for each get in the Game class (see code below). In the simplified example below I have reduced this to just 3 fields, one which can be NULL. I...
5
by: rettigcd | last post by:
I have several classes that all have the same static member: class A{ public static string Table = "TableA"; } class B{ public static string Table = "TableB"; }
4
by: Emil | last post by:
Can somebody tell me what would be the syntax for having an if statement and setting the selected index of a radiobuttonlist? This is my first project using ASP.net and I use C#. I have a repeater...
13
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
0
by: den 2005 | last post by:
Hi everybody, I created a Gridview with a TemplateField and there is Label control in ItemTemplate and a DropdownList control in EditItemTemplate, I was to displayed them ok when I click the...
6
by: Richard | last post by:
Which way would you guys recommened to best parse a multiline file which contains two fields seperated by a tab. In this case its the linux/proc/filesystems file a sample of which I have included...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
10
by: Brad Baker | last post by:
I have an asp.net/csharp application that requires a particular variable to work properly. This variable is usually passed via a query string in the URL when the application is first run but under...
21
by: no1zson | last post by:
I do not even know how to correctly ask this question. I have an item field in the code I am about to post. Simple intger meant to be an item number for a cd. The user enters this number. Over the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.