September 14, 2013 at 3:19 am
datediff(YEAR, BirthDate, getdate())
[font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]
September 14, 2013 at 6:16 am
You do realize that your code will only 25% of the time for individuals born on 2/29 of a leap year, right?
September 14, 2013 at 8:17 pm
did not notice that.
September 15, 2013 at 1:47 pm
Erland Sommarskog (9/14/2013)
datediff(YEAR, BirthDate, getdate())
Doesn't work, Erland. Consider a baby born on 12/31 of some year and using your code the next day.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 15, 2013 at 2:59 pm
Jeff Moden (9/15/2013)
Doesn't work, Erland. Consider a baby born on 12/31 of some year and using your code the next day.
In that case, there is some other bug. The proposition was that we had already selected people born on this day. That baby should not get a mail until 364 days later.
[font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]
September 15, 2013 at 5:16 pm
Erland Sommarskog (9/15/2013)
Jeff Moden (9/15/2013)
Doesn't work, Erland. Consider a baby born on 12/31 of some year and using your code the next day.In that case, there is some other bug. The proposition was that we had already selected people born on this day. That baby should not get a mail until 364 days later.
Ah... got it. No complex age calculation required if you send it out on the birthday.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply