Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

come estrarre solo l'anno dalla data in sql server 2008?

year(@date)
year(getdate())
year('20120101')

update table
set column = year(date_column)
whre ....

o se ne hai bisogno in un'altra tabella

 update t
   set column = year(t1.date_column)
     from table_source t1
     join table_target t on (join condition)
    where ....