我不断在 SSMS(使用 v17.7)和 RedGate SQL Prompt 中收到警告:
const UDF 的错误使用
它强调SYSUTCDATETIME()
以下SYSUTCDATETIME()
两处都有下划线
SELECT 2
FROM (VALUES (CAST('2020-06-26' AS DATETIME2(7)))) AS s (SampleAt)
WHERE s.SampleAt BETWEEN SYSUTCDATETIME() AND DATEADD(DAY, 100, SYSUTCDATETIME())
以下内容根本没有强调它:
SELECT 2
WHERE CAST('2020-06-26' AS DATETIME2(7)) BETWEEN SYSUTCDATETIME() AND DATEADD(DAY, 100, SYSUTCDATETIME())
也根本没有强调它:
DECLARE @now AS DATETIME2 = SYSUTCDATETIME()
SELECT 2
FROM (VALUES (CAST('2020-06-26' AS DATETIME2(7)))) AS s (SampleAt)
WHERE s.SampleAt BETWEEN @now AND DATEADD(DAY, 100, @now)