I have a sql table of people data named caduti with date column data_nasc(date of birth) and data_dec(date of death).
I need to calculate age (in years) at death and set this value in eta column.
I have tried some query, like this one:
UPDATE caduti
SET caduti.eta =     
    DATEDIFF(YY, caduti.data_nasc, caduti.data_dec) - 
    CEILING
     (0.5 * SIGN (
        (MONTH(caduti.data_nasc) - MONTH(caduti.data_dec)) * 50
         + DAY(caduti.data_nasc) - DAY(caduti.data_dec)
        )
      )
but it doesn't work. My need is not only t calculate the ages but also to store them in table column. Any help?