ISNULL tests a value for null and returns the value or a default if the value is NULL.


ISNULL( <value>, <replacement-for-null> )


ISNULL will return one of two values:

  • If the first parameter IS NOT NULL, it will be returned
  • If the first parameter IS NULL, the second parameter will be returned
For example, ISNULL can check for a null date and return a date. Here, this technique is combined with GETDATE to account for NULL Event End Dates in a between statement. If the Event_End_Date is NULL, the function uses tomorrow as the date instead:
GETDATE() BETWEEN Event_Start_Date AND ISNULL([Event_End_Date], GETDATE()+1)

View Examples