Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)

  • RE: Find Last Day of the Month

    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...

  • RE: Find Last Day of the Month

    Another way to do this :

    1) Add 1 month

    2) Substract the day number of the previous result :

    DECLARE @mydate datetime='20080224'

    SELECT DATEADD(day, -DATEPART(day, @Mydate), DATEADD(MONTH, 1, @mydate))

Viewing 2 posts - 1 through 2 (of 2 total)