MONTH function is used to get month part of the specified date.
Syntax of MONTH Function :
MONTH(date)
date is an expression returning a datetime or smalldatetime or a character string in a date format.
IT returns an integer value.
Examples of MONTH Function :
Example 1 : Use of MONTH function in select clause
SELECT MONTH('11/30/2002')
Output
11
Above example returns month in numeric of specified string date.
Example 2 : Use of MONTH function in where clause
SELECT ShipName, OrderDate
FROM Orders
WHERE DATEPART(MONTH,OrderDate) = MONTH('11/30/2002')
Output
ShipName OrderDate
White Clover Markets 1996-11-01 00:00:00.000
QUICK-Stop 1996-11-04 00:00:00.000
Rattlesnake Canyon Grocery 1996-11-05 00:00:00.000
Familia Arquibaldo 1996-11-06 00:00:00.000
Die Wandernde Kuh 1996-11-07 00:00:00.000
Above example returns orders placed in 11th month.