CREATE FUNCTION dbo.IsLeapYear (@Year INT) RETURNS BIT
/* 20220215/RN - https://www.mssqltips.com/sqlservertip/1527/sql-server-function-to-determine-a-leap-year */
AS
BEGIN
    RETURN(SELECT CASE DATEPART(mm, DATEADD(dd, 1, CAST((CAST(@Year AS VARCHAR(4)) + '0228') AS datetime)))
    WHEN 2 THEN 1
    ELSE 0
    END)
END
