Back

Tip 31. Avoiding Nulls in SQL Anywhere.

If you have a select that has values that can be null, but you what to ensure that nulls are handled try using on of these functions

ISNULL returns the first none null value. Do not confuse it with the IsNull() datawindow function. COALESCE() is identical to ISNULL().

e.g.

   ISNULL( part_cost1, part_cost2, 0)

IFNULL returns the second expression if the first is null otherwise it returns the third.

e.g.

   IFNULL(part_cost1, 0, part_cost1)

Added before 01 Jan 2000

Back