Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accurately calculating a persons age
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00953701
Message ID:
00953922
Views:
12
>Hi
>I am trying to create a function in either VFP8 or transact-SQL which will accurately determine if someone is 18 years old or more.
>
>I have had a few stabs at it, but I'm sure I've seen functions in the past that have done this.
>
>Does anyone know of such code or can point me at a back issue of FPA etc.?
>
>TIA,

Simon,

Since no one has bother with a T-SQL solution
CREATE FUNCTION Over18(@ttDOB DateTime)
RETURNS bit
AS
  BEGIN
    DECLARE @llover AS bit
    SET @llover = (DATEADD(yy, 18, @ttDOB)> GETDATE())
    RETURN @llover
  END
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform