I created a scalar user defined function that will accept a date of birth and return the age a person will be in 15 years from now.
CREATE FUNCTION AgeIn15 (@DateOfBirth DATE) RETURNS INT AS BEGIN RETURN Convert(INT, DateAdd(year, 15, DateDiff(year, @DateOfBirth, GetDate()))) END Now I want to Use the UDF created to show the age of all persons in my table marketing_list along with their original information. How do I do this? I tried this but I got an error
SELECT * FROM marketing_list AgeIn15(marketing_list.DateOfBirth) SELECT * ,AgeIn15(marketing_list.Date_of_Birth) FROM marketing_list WHERE AgeIn15(Date_of_Birth) > 45