Viewing 2 posts - 1 through 2 (of 2 total)
You're right :
I think I wrote the good instructions but a wrong SQL.
This might be better :
1) Add 1 month
2) Substract the day number of the previousresult :
DECLARE @mydate datetime='20080331'
SELECT...
May 10, 2011 at 12:58 am
#1322118
Another way to do this :
2) Substract the day number of the previous result :
DECLARE @mydate datetime='20080224'
SELECT DATEADD(day, -DATEPART(day, @Mydate), DATEADD(MONTH, 1, @mydate))
May 10, 2011 at 12:19 am
#1322101