Can anyone please help me using the GETDATE function code below?
I would like to check the date using the following:
If @Start_Date is less than 1-12 months then it should say 'PASSED W/IN 1 YEAR'
If @Start_Date is less than 24 months then it should say 'PASSED W/IN 2 YEARS'
Else if @Start_Date is over 24 the 'FAILED'
DECLARE @START_DATE DATE
SET @START_DATE = '2021-05-01 00:00:00.000'
WHEN month(GETDATE()) - 12 THEN 'PASSED W/IN 1 YEAR'
WHEN month(GETDATE()) - 24 THEN 'PASSED W/IN 2 YEARS'
WHEN month(GETDATE()) - 25 THEN 'FAILED'
END AS PASS_FAIL
Many thanks in advance.