Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

NEXT_DAY function (extension)

Syntax

NEXT_DAY ( date_expression, day_of_week )

Description

The scalar function NEXT_DAY returns the minimum date that is greater than the date corresponding to the first argument for which the day of the week is same as that specified by the second argument.

Example

SELECT NEXT_DAY (order_date, 'MONDAY')

FROM orders ;

Notes

  • The first argument to the function must be of type DATE.
  • The second argument to the function must be of type NCHAR or NVARCHAR for Unicode builds and type CHAR or VARCHAR for ANSI builds. The result of the second argument must be a valid day of week (‘SUNDAY’, ‘MONDAY’ etc.)
  • The result is of type DATE.
  • If any of the argument expressions evaluates to null, the result is null.

TOCIndex