PaulRobertson14
Showing posts with label
CTE
.
Show all posts
Showing posts with label
CTE
.
Show all posts
Tuesday, 9 April 2013
List of Month Names Using CTE
WITH
CTEMonth
AS
(
SELECT
1 AS month_number
UNION
ALL
SELECT
month_number + 1
FROM
CTEMonth
WHERE
month_number <= 11
)
SELECT
month_number,DATENAME(MONTH, DATEADD(MONTH, month_number, 0) - 1) [month_name]
FROM
CTEMonth
Home
Subscribe to:
Posts (Atom)