madhu.gut (5/6/2010)
Hi AllHow should i convert the month name to month number like
'April' it should converted to 4
'January' it should converted to 1
in this how should i do this
can any one suggest the correct answer
There've been a lot of answers to this question and they could all be unnecessary because SQL Server is very forgiving for most date formats. With that thought in mind, what does the original data look like? And I'm not just talking about the month name. For example, if your trying to convert a string to an SQL Datetime and the date looks like '1 June 2010', there you don't need to find the month number to do the conversion....
SELECT CAST('4 June 2010' AS DATETIME)
--Jeff Moden
Change is inevitable... Change for the better is not.