I have a table with composite primary key based on three columns.
(Unit, Account, service)
I have another two columns: DOB (this holds date of birth) & Age (this is a new int column which needs to be updated based on DOB and the result will be integer value of years)
I know how to retrieve the reslt for Age
select datediff(Year,DOB,GETDATE()) as AGE
But not sure how to update entire table based on the rows DOB data.
Columns are Unit, Account, Service, DOB, Age
To answer your question:
This will update the entire table as per your requirements.
However, I strongly recommend you look at all the other answers here. Especially the ones about the calculation error in above formula.