age function

Results 1 to 2 of 2

Thread: age function

  1. #1
    Join Date
    Dec 1969

    Default age function

    anyone got a good age function handy? i have one, but it is very crude. i would like to print a list of birthdates and then in another column print the age associated w/ it ... let me know.<BR><BR>thanks,<BR>wl

  2. #2
    Join Date
    Dec 1969

    Default RE: age function

    via sql<BR><BR>DECLARE @DOB datetime, @later datetime<BR>SELECT @DOB=&#039;06/17/1977&#039;, @later=&#039;02/08/2001&#039;<BR>Select DateDIFF(yy,@DOB,@later)-<BR>CASE WHEN @later&#062;=DateAdd(yy,DateDIFF(yy,@DOB,@later), @DOB) <BR>THEN 0 ELSE 1 END AS Age<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts