Use undocumented spt_values in master database and DATEADD() function
SELECT DATEADD(d, number, '2010-01-01')
FROM master..spt_values
WHERE type = 'P'
AND number < 365
Saturday, December 12, 2009
Get 365 days in 2010 with one query
at 7:19 AM
Labels: SQL Server, SQL Server Tip
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment