Convert month name to month number in SQL Server

In T-SQL what is the best way to convert a month name into a number?


'January' -> 1
'February' -> 2
'March' -> 3


Are there any built in functions that can do this?


How about this?

select DATEPART(MM,'january 01 2011') -- returns 1
select DATEPART(MM,'march 01 2011')  -- returns 3
select DATEPART(MM,'august 01 2011') -- returns 8

Need Your Help

How do I merge rows from a select statement based on conditions


Sorry for the vague description, but I'm not sure how to say this.

use Owin OAuth 2.0 in multi tenant site

c# forms-authentication owin

I am currently using Owin 2.0 in my multi tenant CMS. I need a way to change the facebook app id and secret depending on the tenant.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.