portableSql
IfNull Portable SQL Function
Syntax
IfNull as A (Expression as L, Replacement as A)
Arguments
- ExpressionLogical
A field or expression.
- ReplacementAny Type
The value to return if the expression evaluates to NULL.
Returns
- resultAny Type
Returns the specified replacement value if the expression evaluates to NULL. Otherwise, returns the value of the expression.
Description
Returns a replacement value if the specified expression or field evaluates to NULL.
Discussion
The IfNull function determines if the expression is NULL. If the expression is not NULL, returns the value of the expression. Otherwise, IfNull returns the specified replacement value. This function is useful in cases where you would like to display a specific value if a field is NULL.
IfNull() function executed on the Northwind Access database
SELECT FIRST 10 IfNull(ShippedDate, 'Not shipped') AS Shipped FROM Orders ORDER BY OrderID DESC =Not shipped Not shipped Not shipped Not shipped Not shipped Not shipped Not shipped Not shipped 6/5/1996 Not shipped