Saturday, December 12, 2009

Get 365 days in 2010 with one query

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

No comments:

Post a Comment

Oracle Query