Alex Rivera | Logout

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

Asked 2012-09-15T10:51:09.180
89

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?

Edit
Report

2 Answers

18
select year(current_timestamp)

SQLFiddle demo

answered 2012-09-15T10:52:09.003
15

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

Syntax:

YEAR ( date )

For more information check here

answered 2012-09-15T11:01:56.577

Your Answer