Add fnAgeOn utility function
Defines a utility function for calculating an age based on a given birth date and "as-of" date.
The calculation is as follows:
datediff(YEAR, @birthdts, @ondts) - iif(dateadd(YEAR, datediff(YEAR, @birthdts, @ondts), @birthdts) > @ondts, 1, 0)
Using this function incurs a slight performance penalty, see documentation here. For this reason, the function is not used in any views which calculate an "Age At" value. If our database is ever updated to a version which supports UDF inlining, we will revisit.
Edited by Hubbell, Harrison Taylor