SQL Server Date Function MONTH()

The MONTH() function in SQL Server is used to extract the month from a given date or datetime value. It takes one argument, which is the date or datetime value to extract the month from.

The syntax of the MONTH() function is as follows:

MONTH(date)
‮ruoS‬ce:www.theitroad.com

Here's an example of how to use the MONTH() function in a SQL query to extract the month from a date value:

SELECT MONTH('2022-02-28');

This query will return the integer value 2, which is the month in the date.

In this example, the date is "2022-02-28", which is the date to extract the month from.

Note that the MONTH() function is specific to SQL Server and the syntax and date format it supports may vary slightly depending on the system. Additionally, the MONTH() function only extracts the month and cannot be used to extract other parts of the date or datetime value.