有人可以建议在SQL Server中使用最短的查询来获取日期中的月份名称吗?
我试过这个查询
select
datename(month, dateadd(month, @mydate - 1, cast('2008-01-01' as datetime)))
答案 0 :(得分:3)
试试这个......
SELECT DATENAME(month, getdate()) AS [Month Name]
答案 1 :(得分:2)
select CONVERT(varchar(3), getdate(), 100) as Month
或
select FORMAT(getdate(), 'MMMM')
答案 2 :(得分:0)
$ coreapi action snippets create --param title="Example" --param code="print('hello, world')"
{
"url": "http://127.0.0.1:8000/snippets/6/",
"id": 6,
"highlight": "http://127.0.0.1:8000/snippets/6/highlight/",
"owner": "admin",
"title": "Example",
"code": "print('hello, world')",
"linenos": false,
"language": "python",
"style": "friendly"
}
答案 3 :(得分:0)
SELECT FORMAT(getdate(),'MMMM')AS [Month Name]