This article is half-done without your Comment! *** Please share your thoughts via Comment ***
Check the below input data and expected output for generating the complete calendar data for 19th century.
Input Date: 19000101
Expected Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
CalendarDate ------------ 1900-01-01 1900-01-02 1900-01-03 1900-01-04 1900-01-05 1900-01-06 1900-01-07 1900-01-08 1900-01-09 ..... ..... ..... 2000-12-25 2000-12-26 2000-12-27 2000-12-28 2000-12-29 2000-12-30 2000-12-31 |
Solution:
1 2 3 4 5 |
SELECT TOP (36890) CAST(DATEADD(day, ROW_NUMBER() OVER (ORDER BY a.[object_id])-1, '19000101') AS DATE) AS CalendarDate FROM sys.all_objects AS a CROSS JOIN sys.all_objects AS b OPTION (MAXDOP 1); |
Please try the different solution for this puzzle and share it via comment...