Solved

Null value in SQL statement

Posted on 2003-10-27
2
221 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 61
Determine Range to Select 5 56
Spell Check in VB6 13 135
Fastest way to find and count same items VB6 16 43
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

735 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