473,408 Members | 1,601 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,408 software developers and data experts.

Result of comparing null

I have a column on my table which may contain yes,no or null. I have learned that comparing null values will always result to FALSE. I have created a condition in one of my queries which is something like this:

Where column1 <> 'Yes'

I need to display entries where column1 is either 'No' or is null. Now my question is, would the null values satisfy this condition?

I know i can just do something like:

where isnull(column1,'') <> 'Yes'

or:

where column1 = 'No' OR column1 is null

I just want to know the reason behind the result. Thanks
Nov 15 '11 #1
3 1840
ck9663
2,878 Expert 2GB
I'm not sure where you learn that comparing a NULL value to a non-NULL value will always return FALSE. Depending on the structure of your comparison, it will not always return FALSE, but UNKNOWN. Here, start from here.


Happy Coding!!!


~~ CK
Nov 15 '11 #2
So now it really is a three valued logic, true, false and unknown. meaning null is never equal or unequal to anything, because the result is unknown.

Thanks!
Nov 15 '11 #3
ck9663
2,878 Expert 2GB
Yes. You cannot check if a value is equal to NULL. But you can check if a value is NULL.

Happy Coding!!!


~~ CK
Nov 16 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Neil Aggarwal | last post by:
Hello: I am using gcc on RedHat Linux 9. When I try to do a reverse dns query using gethostbyaddr, it works fine for hosts that have a PTR record, but it returns null for hosts that have a...
7
by: pervinder | last post by:
Hi, I have a c applicaiton which uses calloc to allocate the storage from heap. A page is allocated (4096bytes) and then its used in smal small chunks on need. It works fine till some n number...
2
by: Christoph Nahr | last post by:
Question: Will C# 2.0 offer a way to directly and reliably produce the fastest MSIL null check, i.e. a single opcode? The current C# compiler will emit this opcode automatically when comparing a...
3
by: Gil D. | last post by:
Hello, I have a query with 2 sub queries. Each query returns one value. My query should sum these values and display the sum. For example: sub query 1 returns 5 sub query 2 returns 10 my...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
20
by: Bill Pursell | last post by:
This question involves code relying on mmap, and thus is not maximally portable. Undoubtedly, many will complain that my question is not topical... I have two pointers, the first of which is...
15
by: info | last post by:
Hi, I need this behaviour: 1 + null = 1 I have a (dynamic) set of many columns containing decimals that I want to add as follows: if all columns are null the result should be null if not all...
3
by: arial | last post by:
Hi, I am having trouble checking a sql query result = null in c#. my query is like, sqlcommand cmd.commandText = "select cqinum from table1"; how can cmpare this result to null?
1
by: c.greinke | last post by:
I have a problem with the way that the generated proxy handles the information when trying to return information from an emulated webservice. When trying to consume the emulated service, the...
7
by: cbjones | last post by:
I am trying to create a query such that when pulling data from a table, then If the result is "NULL", replace "NULL" in the column with a "blank"...OR... if the result is a string (not NULL),...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.