﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Programming / General  / Correct Age calculation / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 17:54:46 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Correct Age calculation</title><link>http://www.sqlservercentral.com/Forums/Topic1231756-23-1.aspx</link><description>This is how I do it...[quote]select c.clientid, convert(char(10),c.dateofbirth,101) as DOB,	case 	when ((MONTH(c.dateofbirth) * 100) + DAY(c.dateofbirth)) &amp;gt;  ((MONTH(getdate()) * 100) + DAY(getdate()))		then DATEDIFF(year,c.dateofbirth,getdate()) - 1	else DATEDIFF(year,c.dateofbirth,getdate()) End As Age from clients c [/quote]</description><pubDate>Thu, 12 Jan 2012 07:25:56 GMT</pubDate><dc:creator>jshahan</dc:creator></item><item><title>RE: Correct Age calculation</title><link>http://www.sqlservercentral.com/Forums/Topic1231756-23-1.aspx</link><description>Thanks,That works great, but Im new at SQL and have tried but can't get the syntax right..What if I wanted to select bdate from the "Client" file as date1 and getdate() as date2 ?ThanksJoe</description><pubDate>Tue, 10 Jan 2012 09:00:50 GMT</pubDate><dc:creator>jbalbo</dc:creator></item><item><title>RE: Correct Age calculation</title><link>http://www.sqlservercentral.com/Forums/Topic1231756-23-1.aspx</link><description>Here is good article for calculating age.[url]http://www.sqlservercentral.com/articles/T-SQL/63351/[/url]</description><pubDate>Sat, 07 Jan 2012 10:42:41 GMT</pubDate><dc:creator>padhis</dc:creator></item><item><title>RE: Correct Age calculation</title><link>http://www.sqlservercentral.com/Forums/Topic1231756-23-1.aspx</link><description>Hi Try this post from my blog[url]http://sqlblogcasts.com/blogs/sqlandthelike/archive/2009/12/08/age-calculation-with-sql-server.aspx[/url]</description><pubDate>Fri, 06 Jan 2012 14:59:23 GMT</pubDate><dc:creator>Dave Ballantyne</dc:creator></item><item><title>Correct Age calculation</title><link>http://www.sqlservercentral.com/Forums/Topic1231756-23-1.aspx</link><description>We are using the following to calculate age:It doesn't seem correct ?Any ideas would be great?ThanksJoeINSERT INTO @TEMPTABLE(TAG_NAME,TAG_DATA)	SELECT TAG_NAME = 'CUST_AGE', TAG_DATA = (SELECT DATEDIFF (yy,bdate, GETDATE())FROM client	WHERE Client.OID =@CLIENT_OID);</description><pubDate>Fri, 06 Jan 2012 14:52:54 GMT</pubDate><dc:creator>jbalbo</dc:creator></item></channel></rss>