how to extract only the year from the date in sql server 2008?

前端 未结 9 2374
遥遥无期
遥遥无期 2020-12-15 02:09

In sql server 2008, how to extract only the year from the date. In DB I have a column for date, from that I need to extract the year. Is there any function for that?

9条回答
  •  别那么骄傲
    2020-12-15 03:04

    You can use year() function in sql to get the year from the specified date.

    Syntax:

    YEAR ( date )
    

    For more information check here

提交回复
热议问题