I have a table listing people along with their date of birth (currently a nvarchar(25))
How can I convert that to a date, and then calculate their age in years?
This will correctly handle the issues with the birthday and rounding:
DECLARE @dob datetime SET @dob='1992-01-09 00:00:00' SELECT DATEDIFF(YEAR, '0:0', getdate()-@dob)