Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Scalar Function to Determine Age at a Given Date

By anonuser,

This function was written to supplant cumbersome age-at calculations.  To execute, simply set a local INT variable equal to the output of the function.  For example, the following, given my birthdate, computes my own age:

    DECLARE @age_at INT

    SET @age_at = dbo.f_age_at ('2/16/1954', GETDATE ())

Total article views: 362 | Views in the last 30 days: 1