SQL Null set to Zero for adding SQL Null set to Zero for adding sql sql

SQL Null set to Zero for adding


Since ISNULL in Access is a boolean function (one parameter), use it like this:

SELECT Column1, Column2, IIF(ISNULL(Column3),0,Column3) + IIF(ISNULL(Column4),0,Column4) AS [Added Values]FROM Table


According to Allen Browne, the fastest way is to use IIF(Column3 is Null; 0; Column3) because both NZ() and ISNULL() are VBA functions and calling VBA functions slows down the JET queries.

I would also add that if you work with linked SQL Server or Oracle tables, the IIF syntax also the query to be executed on the server, which is not the case if you use VBA functions.


Even cleaner would be the nz function

nz (column3, 0)