我有这个查询
select
format([time], 'MMMM') as 'Month',
count([time]) as 'Application Usage',
count([time]) as 'Application Usage'
from
UserLogs UL
where
[time] >= Dateadd(Month, Datediff(Month, 0, DATEADD(m, -6, current_timestamp)), 0)
and Ul.UserId = @user
group by
format([time],'MMMM')
但是,我使用 SQL Server 2008 迁移到服务器,但出现此错误:
“格式”不是可识别的内置函数名称
我可以用什么来替换这个格式函数?
这是 SQL Server 2012 及更高版本的一项功能。尝试DATENAME(MONTH,[time]).
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句