函数参数列表中的错误:“=”无法识别。无法解析 SSRS 中的查询

Error in list of function arguments: '=' not recognised. Unable to parse query in SSRS

您好,我正在尝试在 SSRS 中创建报告,我正在使用以下查询来获取日期差异和比较。

IIF ((CAST(issues.created_at as smalldatetime)) = (CAST(sprints.created_at as smalldatetime)) OR (DATEDIFF(Minute,CAST(sprints.created_at as smalldatetime), CAST(issues.created_at as smalldatetime)) < 2),1,0) as new_task
    

但我收到错误“函数参数列表中的错误:'='无法识别。无法解析查询”

我需要在代码中更改什么吗?

看来您的SQL服务器版本不支持IIF(2012年新增)。

将其更改为具有相同功能的 CASE 语句。

SELECT...,
CASE WHEN CAST(issues.created_at AS SMALLDATETIME) = CAST(sprints.created_at AS SMALLDATETIME) 
                OR DATEDIFF(MINUTE, CAST(sprints.created_at AS SMALLDATETIME), CAST(issues.created_at AS SMALLDATETIME)) < 2
            THEN 1 ELSE 0 END AS new_task