http://www.databasejournal.com/features/mssql/article.php/1459151/SQL-2000-UDF-to-return-the-age-of-a-person-given-a-date-of-birth.htm
SQL 2000 UDF to return the age of a person, given a date of birthApril 5, 2001 SQL Server 2000 script for creating a user defined function that returns the age of person whose date of birth has been provided. To use the function:
SELECT dbname.dbo.GetAge(DateOfBirth, GETDATE()), column1, column2....,
Alternatively
SELECT * FROM TableName
Unfortunately SQL Server 2000 doesn't allow for the use of GETDATE() within user defined functions so it needs to be passed explicitly as a parameter. |
The Network for Technology Professionals
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers