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....,
SELECT * FROM TableName
WHERE dbname.dbo.GetAge(DateOfBirth, GETDATE()) > n
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.