Re: Calculating and displaying "Age"

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Steve Z (szlamany_at_antarescomputing.com)
Date: 03/08/04


Date: Mon, 8 Mar 2004 11:21:11 -0800

Thank you very much - we hate little bugs like that...

I think I'll change the Cast(... as datetime) to a nice CONVERT(CHAR(10),@date,112) to make it a character YYYYMMDD comparison - on both sides of the ">"
     
     ----- Gert-Jan Strik wrote: -----
     
     This query will throw an error if the date of birth is on 29th of
     February, and SomeDate is not a leap year...
     
     Gert-Jan
     
     
     Steve Z wrote:
>> We always use:
>> Set @Age=datediff(YYYY,@DOB,@SOMEDATE)
> -CASE WHEN
> CAST(CONVERT(CHAR(6),@DOB,101)+CAST(DATEPART(YYYY,@SOMEDATE) AS VARCHAR(4)) AS DATETIME)
>>@SOMEDATE THEN 1 ELSE 0 END
     
     --
     (Please reply only to the newsgroup)
     



Relevant Pages

  • Re: Access SQL - date sieve
    ... So now, bringing in ancillary file Weeks, having a list of all (WeekEnding) ... You can now group by this field in your totals query, ... Event SomeDate ... FROM Weeks LEFT JOIN on BETWEEN (Sunday-6) AND ...
    (microsoft.public.access.queries)
  • Re: Access SQL - date sieve
    ... thanks for the suggestion of using a calculated field to augment the ... You can now group by this field in your totals query, ... Event SomeDate ... FROM Weeks LEFT JOIN on BETWEEN (Sunday-6) AND ...
    (microsoft.public.access.queries)
  • Re: Odd Circumstance Free BMD
    ... I answered your query on the FreeBMD Mailing list on 5 Mar 2008 please ... I now find that the birth 'fits' my family tree ... ... I have written to Free BMD on two occasions in recent weeks to draw it to ...
    (soc.genealogy.britain)
  • Re: how can we use Sum IF
    ... I tried to have a report to show the events in our church. ... is too complicated to my understanding, so I use Select Query and on each ... However Although I filter only for Feb for example, all the dates of birth ...
    (microsoft.public.access.formscoding)
  • Re: how cen I use VBA to open a combo box with parameters
    ... say [SomeDate] contains today's date. ... what about a stallion that is currently eligible - is his second ... Graham Mandeno ... You should remove the parameter from the query and supply the parameter ...
    (microsoft.public.access.formscoding)