• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

How to display month names for data range.

If i have selected 2 dates as from 1-Oct-2010   and todate as 28-Feb-2011
How to get the results as
2010-October
2010-November
2010-December
2011-Jan
2011-Feb
0
searchsanjaysharma
Asked:
searchsanjaysharma
  • 2
  • 2
1 Solution
 
tim_csCommented:
SELECT  CAST(YEAR(GETDATE()) AS VARCHAR(4)) + '-' + DATENAME(m,GETDATE())
0
 
searchsanjaysharmaAuthor Commented:
How to get this in ascending order
0
 
tim_csCommented:
You should be able to just order by the date itself.

SELECT  CAST(YEAR(GETDATE()) AS VARCHAR(4)) + '-' + DATENAME(m,GETDATE())
FROM
   YourTable
ORDER BY
   GETDATE()
0
 
searchsanjaysharmaAuthor Commented:
Thanx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now