CONVERT(int, (datepart(month, @search)), (datepart(day, @search)), DateAdd(year, Years.Year - (datepart(year, @search)))
- by MyHeadHurts
In the query the top part is getting all the years that will run in the stored procedure. Works fine
But at first i just wanted to run the queries for yesterdays date for all the years, but now i realized i want the user to select a date that will be in a parameter @search
Booked <= CONVERT(int,DateAdd(year,
Years.Year - Year(getdate()),…