Hey Everyone, I am trying to generate a @StartDate and @EndDate. The @StartDate would be the 1st of January and the year is dependent on the @EndDate. The @EndDate would be select max(DateValue) from dbo.testtable
The column DateValue in the testtable contains dates such as 2013-12-09, 2013-12-15. What I am trying to accomplish is if the @EndDate is populated by select max(DateValue) from dbo.testtable returns '2013-12-15' as the max(DateValue). I want the @StartDate to '2013-01-01' because the year of the EndDate is 2013. So something along the lines of @StartDate = DateAdd(yy,?,@EndDate)
Any suggestions?Thanks