Last day of previous month

I am working on a query I need to run monthly. This query includes a “date” field which I need to fill in with the LAST day of thePREVIOUS month of this year. I am trying to do this by:
But it tells me that there is a syntax error(missing operator) in query expression. I have always worked with MySQL, so I’m not sure that the syntax is right. It could also be that I am working with the TOAD version for Data Analyst, although just with the editor part.
I would very much appreciate any ideas you cane give me.
And thanks in advance for you time!

Hi Teleki
I think you’ll be better off posting your query in an actual T-SQL forum, these forums relate to the use, configuration etc of Toad for SQL Server.

Thanks in advance


There is also a forum for Toad for Data Analysts, here’s the link:


I notice this is not T-SQL developer’s forum.

Anyway it seems to me that your query is something unsupported for MS SQL Server. I would recommend you to use something similar to this:
SELECT DATEADD(s, -1, DATEADD(mm, DATEDIFF(m, 0, GETDATE()), 0)) AS LastDayOfPrevMonth

you may also look into online book:

or Google:

Thank you Valentine!
And I’m sorry about posting it in the wrong place! :S