Link to home
Start Free TrialLog in
Avatar of searchsanjaysharma
searchsanjaysharma

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of tim_cs
tim_cs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of searchsanjaysharma
searchsanjaysharma

ASKER

How to get this in ascending order
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()
Thanx