Saturday, May 16, 2015

Sql Server order by month name


Following Script will order the result in actual calendar month order.

SELECT *  FROM [dbo].[tablename]
ORDER BY DATEPART(mm,CAST([DateFieldColumnName] + ' 1900' AS DATETIME)) ASC


Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.