Convert month name to month number in SQL Server

后端 未结 13 1232
情话喂你
情话喂你 2020-12-01 13:57

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

E.g:

\'January\' -> 1
\'February\' -> 2
\'March\' -> 3
相关标签:
13条回答
  • 2020-12-01 15:02
    select  Convert(datetime, '01 ' +  Replace('OCT-12', '-', ' '),6)
    
    0 讨论(0)
提交回复
热议问题