Sometimes we have a date and we need to extract components of the date. For example, we might have a date and wonder what's the year or we have a date and wonder what the month is or the day.
While there are several ways to extract the year, the month, and/or the day from a date in SQL Server, there are functions designed to do precisely that.
The YEAR function takes a date and extracts the year. The MONTH function takes a date and extracts a month (as a month number from 1 to 12). And the DAY function takes a date and returns the day (again as a day number like 28, not the name of the day like Tuesday).
It's worth your while becoming proficient in SQL. If you'd like to learn a lot about T-SQL in a hurry, our Writing T-SQL Queries for SQL Server course is online, on-demand, and low cost.