我创建了一个在SSRS中使用小数作为参数的查询。下面的代码(@TrueDemand
)在我的本地PC上运行时,通过数据页面查询引发错误trying to convert nvarchar to int
。
但是,当在预览中运行它甚至将报告发布到Web时,它运行正常:(
非常令人沮丧。有什么想法吗?
SELECT AD.LogDate,
AD.Location,
AD.FunctionDescription as Func,
AD.Offered,
AD.Handled,
AD.Handled + ((AD.Offered - AD.Handled) * @TrueDemand) as TrueDemand,
AD.Handled30,
AG.SignedIn,
AG.Available,
AG.WorkloadSecs,
AG.FullAHTSecs
FROM dbo.vw_ApplicationDetail_Minus15mins AD
INNER JOIN dbo.vw_AgentGroupDetail AG ON
AD.Logdate = AG.Logdate AND
AD.Location = AG.Location AND
AD.FunctionDescription = AG.FunctionDescription
WHERE AD.Logdate between @Logdate AND dateadd(d,1,@Logdate) AND
AD.Location = @Location AND
AD.FunctionDescription = @Function
ORDER BY AD.Logdate
答案 0 :(得分:1)
您是否尝试过显式转换为该行上的所有变量的十进制数。
cast(AD.Handled as Decimal) + ((Cast(AD.Offered as Decimal) - Cast(AD.Handled as Decimal)) * Cast(@TrueDemand as Decimal)) as TrueDemand