SQLTeam.com | Weblogs | Forums

Use SSRS to sort my month parameter


#1

my current month param shows month as

January
April
May
June
etc..........
i would like it to ordered in descending
december
november
october
september
etc...


#2

It would have been nice to have a consumable data set. Also what have you tried?

Here is one way[code]
select DATENAME(month,'1/1/2016') mname
into #tempx
UNION
select DATENAME(month,'2/1/2016')
UNION
select DATENAME(month,'3/1/2016')
UNION
select DATENAME(month,'4/1/2016')
UNION
select DATENAME(month,'5/1/2016')
UNION
select DATENAME(month,'6/1/2016')
UNION
select DATENAME(month,'7/1/2016')
UNION
select DATENAME(month,'8/1/2016')
UNION
select DATENAME(month,'9/1/2016')
UNION
select DATENAME(month,'10/1/2016')
UNION
select DATENAME(month,'11/1/2016')
UNION
select DATENAME(month,'12/1/2016')

SELECT mname
FROM #tempx
ORDER BY CAST(Mname + ' 1 2016' AS DATE) DESC;
[/code]