Home Forums SQL Server 2005 SQL Server 2005 General Discussion display the days for given month RE: display the days for given month
Florian Reischl
SSC-Dedicated
Points: 37301
More actions
May 26, 2009 at 2:48 am
#999755
Hi
I would advice to use a Tally table:
DECLARE @Month DATETIME
SELECT @Month = '2009-02-01'
SELECT
N
FROM Tally
WHERE
N <= DATEDIFF(DAY, @Month, DATEADD(MONTH, 1, @Month))
For sure, this could also be done with a Calendar table.
Greets
Flo