使用“报表”构建器并尝试将数据集过滤器“移动”到数据集查询,以提高报表性能。
“从查询结果集中读取数据时发生错误。将varchar值'70048-'转换为数据类型int时转换失败。”
这是我的Where语句(无参数)
WHERE (JCCD.CostType = 1) AND JCCD.Job = '88800-'
这是我提供参数
后出错的Where语句WHERE (JCCD.CostType = 1) AND JCCD.Job = @JobParam
完整的SQL语句
SELECT HQCO.Name, JCCD.JCCo, JCCD.Job, JCCD.Phase, JCJM.Description, JCJP.Description AS PhaseDescription, CAST(JCCD.EstHours AS Numeric) AS EstHours,
CAST(JCCD.EstCost AS Numeric) AS EstCost, CAST(JCCD.ActualHours AS Numeric) AS ActualHours, CAST(JCCD.ActualUnits AS Numeric) AS ActualUnits,
CAST(JCCD.ActualCost AS Numeric) AS ActualCost, JCCD.CostType, JCCD.UM, JCCD.CostTrans, JCCD.Mth, JCCD.JCTransType, JCJM.Job AS Expr2, JCCD.ActualDate,
JCCH.UM AS UM2, CAST(JCCD.EstUnits AS Numeric) AS EstUnits, JCCD.ProjUnits, JCCH.CostType AS Expr4, JCCD.ProjHours, JCCD.ForecastHours,
JCCD.ForecastUnits, JCCD.ForecastCost, CONVERT(INT,LEFT(JCCD.Phase,3)) AS PhasePreFix
FROM JCCD AS JCCD INNER JOIN
JCJM AS JCJM ON JCCD.JCCo = JCJM.JCCo AND JCCD.Job = JCJM.Job INNER JOIN
HQCO AS HQCO ON JCCD.JCCo = HQCO.HQCo INNER JOIN
JCJP AS JCJP ON JCCD.JCCo = JCJP.JCCo AND JCCD.Job = JCJP.Job AND JCCD.PhaseGroup = JCJP.PhaseGroup AND JCCD.Phase = JCJP.Phase INNER JOIN
JCCH AS JCCH ON JCCD.JCCo = JCCH.JCCo AND JCCD.Job = JCCH.Job AND JCCD.PhaseGroup = JCCH.PhaseGroup AND JCCD.Phase = JCCH.Phase AND
JCCD.CostType = JCCH.CostType
WHERE
(JCCD.CostType = 1) AND (JCCD.Job = '88800-')
ORDER BY JCCD.JCCo, JCCD.Job, JCCD.Phase