Mobile DBMS version: this function is not permitted with DB2 or SQL Server.
Syntax
WEEK(Argument)
Description
The WEEK SQL scalar function returns an integer between 1 and 53 that represents the week of the year (week 1 is the first week in the year that includes a Thursday, which is equivalent to the first week including January 4).
The argument must be a date, or a timestamp.
The result of the function is a large integer.
If the argument can be null, the result can be null; if the argument is null, the result is the null value.
Note the following peculiarities:
-
- With DB2/400 and DB2/UDB, the ISO implementation of the WEEK (WEEK_ISO) function is used.
- With SQL Server, the ISO implementation is forced by automatically creating an ISOweek function in the current profile. Users MUST have the "CREATE FUNCTION" permission in order for this function to be created successfully.
- With ODBC, the result cannot be guaranteed, as the implementation of the function can vary according to the destination DBMS.
Example
Assume ORDER_DATE is February 15, 2003
WEEK(ORDER_DATE) returns 7
List of SQL scalar functions by topic