我在 SQL Server 2012 中有以下完整的查询:
SELECT
iif(((DATEPART(dw, MeasurementTime) + @@DATEFIRST) % 7) < 2,'Weekend','Weekday') AS PartOfWeek,
Seasons.Label AS Season,
CONVERT(TIME,MeasurementTime) AS TimeOfDay,
FeederLoads.FeederNo AS FeederNo,
Avg(FeederLoads.kVA) AS Mean,
StDev(FeederLoads.kVA) AS StdDev
FROM
FeederLoads INNER JOIN
Seasons
ON Month(FeederLoads.MeasurementTime) = Seasons.Month1 OR
Month(FeederLoads.MeasurementTime) = Seasons.Month2 OR
Month(FeederLoads.MeasurementTime) = Seasons.Month3
GROUP BY
((DATEPART(dw, MeasurementTime) + @@DATEFIRST) % 7),
Seasons.Label,
CONVERT(TIME,MeasurementTime),
FeederLoads.FeederNo;
但是,当我将查询复制并粘贴到视图定义窗口的 SQL 窗格中时,视图无法保存。
我得到的错误信息是:
函数参数列表中的错误:“<”无法识别。无法解析查询文本。
任何想法为什么?