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?
DECLARE @DOB datetime set @DOB ='11/25/1985' select floor( ( cast(convert(varchar(8),getdate(),112) as int)- cast(convert(varchar(8),@DOB,112) as int) ) / 10000 )
source: http://beginsql.wordpress.com/2012/04/26/how-to-calculate-age-in-sql-server/