标签: sql-server function reporting-services
我有一份已经运行多年的SSRS报告。截至2016年1月1日,报告的一部分执行时间超过30倍。事实证明是在查询的where子句中使用Year(Getdate())函数。将其更改为声明的变量@CurrYear int = Year(Getdate()),然后在where子句中使用@CurrYear,并将其恢复为不到一秒。为什么这会在2016年1月1日停止工作多年?只是好奇是否有其他人看到过这种行为。
Year(Getdate())
@CurrYear int = Year(Getdate())
@CurrYear
此外,查询在管理工作室运行正常,延迟只发生在报表服务器上。