Jitendra Patel

Jitendra Patel

  • NA
  • 149
  • 0

Month name Like Nov, Dec, Jan ?

Mar 6 2010 5:57 AM
Hi

Please help me
I want to get this output

OUTPUT:-

MonthName Month
---------------
Nov                11
Dec                12
Jan                  1


My table structure like and data this

Month ( int)
11
11
11
12
12
12
1
1
1


my query is this please help me regarding this

SELECT DISTINCT CASE [Month] WHEN 6 THEN 'Jun'
WHEN 7 THEN 'Jul' WHEN 8 THEN 'Aug' WHEN 9 THEN 'Sep'
WHEN 10 THEN 'Oct' WHEN 11 THEN 'Nov' WHEN 12 THEN 'Dec'
WHEN 1 THEN 'Jan' WHEN 2 THEN 'Feb' WHEN 3 THEN 'Mar' WHEN 4 THEN 'Apr'
ELSE 'May' END AS MonthName,[Month] FROM  TESTTable
order by month

Please give me answer or suggestion.

Thanks In Advance,
Jitendra Patel

Answers (6)