Skip to content
Advertisement

EDATE comparable in SQL Server? — Next Anniversary Date Calculation

Can someone help me figure out a formula to be used in SQL Server similar to the Excel formula pasted below?

=EDATE(date,(DATEDIF(date,TODAY(),”y”)+1)*12)

I want to capture the next anniversary date.

The information I have is ID and date. I want to determine next anniversary date.

Advertisement

Answer

Seems you could achieve this fairly easily with DATEADD and DATEDIFF, and a CASE expression if the generated date is less than the current date:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement