I have to get the month from a column which stores string in format -
Column
----------
`Feb2007'
'Sep2008'
So if the value was 'Feb2007'
then I need to get back 2
or else if the value was 'Sep2009'
then I should get back 9
.
Is there inbuilt function in SQL Server 2008 to achieve something like this?
Try this:
select datepart(mm, cast('feb2008' as datetime))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With