Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize Online / PHPize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
WITH Dates AS ( SELECT DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0) AS dt -- First day of current month UNION ALL SELECT DATEADD(day, 1, dt) FROM Dates WHERE DATEPART(month, DATEADD(day, 1, dt)) = DATEPART(month, GETDATE()) ) SELECT dt AS calendar_date FROM Dates OPTION (MAXRECURSION 366); -- Set max recursion limit, 366 covers leap years

Stuck with a problem? Got Error? Ask AI support!

Copy Clear