how to extract only the year from the date in sql server 2008?
year(@date)
year(getdate())
year('20120101')
update table
set column = year(date_column)
whre ....
or if you need it in another table
update t
set column = year(t1.date_column)
from table_source t1
join table_target t on (join condition)
where ....
You can use year()
function in sql to get the year from the specified date.
Syntax:
YEAR ( date )
For more information check here
select year(current_timestamp)
SQLFiddle demo