Search code snippets, questions, articles...

Select only year from date field MSSql query

To extract year from a date in the MSSql Server you can use the year() method of MSSql.
SELECT year(date_column) as my_year FROM table_name;
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

In the above query, we have a table that has a date type column. When selecting this date type column we are only showing its date.

For example, If We have a table named Employee and it has a date type column Join_Date. To get the year from the Join_Date column we can use below MSSql Query.

   year(Join_Date) as join_year 
Was this helpful?