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
How to get the results as
2010-October
2010-November
2010-December
2011-Jan
2011-Feb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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()
SELECT CAST(YEAR(GETDATE()) AS VARCHAR(4)) + '-' + DATENAME(m,GETDATE())
FROM
YourTable
ORDER BY
GETDATE()
ASKER
Thanx
ASKER