Solved

Null value in SQL statement

Posted on 2003-10-27
2
225 Views
Last Modified: 2010-05-03
Hi,

please ammend this SQL code to select records if A1 and A2 fields are Null value. I used '' but it doesn't give me correct answer.

"select * From Table1 Where (((Table1.A1) = '')  And ((Table1.A2) = ''))"

Thanx
0
Comment
Question by:ray14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
j_a_delooze earned 75 total points
ID: 9630187
try:

SELECT * FROM [Table1] WHERE (([Table1].[A1] IS NULL) AND ([Table1].[A2] IS NULL));

-or-

SELECT * FROM [Table1] WHERE (([Table1].[A1] = NULL) AND ([Table1].[A2] = NULL));
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 50 total points
ID: 9630538
j_a_delooze,

If this is MS SQL Server the second solution will not return any values.  Reason: Null <> Null

Anthony
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question