AlphaPress Publishing
P.O. Box 5942 Albany, NY 12205
Tel: 518-250-3890
Email: alphapress@hotmail.com  


  
Click to buy this book from Amazon

Section Menu 

News

Pindaro is now working on a comprehensive book on SQL Server 2014.  For any comments you can email the author at alphapress@hotmail.com.

  

 

 

Looking for nulls using the IsNull() function

To contact the author click here

This article is from the book "Access 2007 Pure SQL

To download the sample database click here


 

Looking for nulls using the IsNull() function

Display all products to find the ones whose SKU is null

Discussion:

The isnull() function provides us with additional functionality in looking for nulls.  Specifically, it will produce a true or false value for all of the entries in the field we are inspecting.  In this example, we use isnull() to check the SKU field for nulls.  For every value in the SKU field, we will get a true or false response from the database.  In Access 2007, the value 0 means false, and the value -1 means true.  In the following datasheet, we will get -1 for the four records with null values. 

Code:

SELECT ProductID, productname, productunitprice, IsNull(SKU) AS SKUCheck

FROM tbls_ProductsN

 

Result: