Nov 21, 2014

[Tips] Create numbers 0 to 23 query

Query below creates numbers 0 to 23.
WITH Hours(h) AS
(
    SELECT 0
    UNION ALL
    SELECT h+1 FROM Hours WHERE h < 23
)
SELECT h FROM Hours

0 comments: