我在SQL端的SSRS2017中有一个报表,我有一个参数过滤器,因为它可以包含多个值,并将其设置为“ in(@SALES_ORDER)”值。我有2个派生表连接到我的主表,其中1个是销售订单号,另一个是生产订单号,在运行时,我得到了注明的“ SQL执行错误。我无法弄清楚为什么会收到错误,我相信它在销售订单号上,“ COOIS”和UNIT_NO DERR表中销售订单号的数据类型为“ BIGINT”
在每个实例中,我都尝试“ CAST(字段名称为INT32)”,但是我仍然可以看到@SALES_ORDER。
代码如下,我不是合格的编码员,仅使用了SSRS工具(对不起):
SELECT MAX(WOL_COOIS_1.BSC_START) AS Start_date, WOL_COOIS_1.LEADGORDER, WOL_COOIS_1.PROJ_NO_8, CAST(WOL_COOIS_1.SALES_ORD AS INT32) AS Expr1, WOL_COOIS_1.DUMP_DATE,
UNIT_No_DERRIVED_TABLE.PURCHASE_ORDER_NUMBER, UNIT_No_DERRIVED_TABLE.PROJ_DESCN, SO_PLANNED_HOURS_DERRIVED_TABLE.SOPT_STANDARDVALUE
FROM WOL_COOIS AS WOL_COOIS_1 LEFT OUTER JOIN
(SELECT TOP (100) PERCENT WOL_COOIS.SALES_ORD AS SOPT_SALES_ORD, SUM(WOL_COOIS_OPS.STD_VALUE_3 * WOL_COOIS_OPS.OP_QTY) AS SOPT_STANDARDVALUE
FROM WOL_COOIS_OPS LEFT OUTER JOIN
WOL_COOIS ON WOL_COOIS_OPS.[ORDER] = WOL_COOIS.[ORDER]
GROUP BY WOL_COOIS.SALES_ORD
HAVING (WOL_COOIS.SALES_ORD IN (@SALES_ORDER))
ORDER BY SOPT_STANDARDVALUE DESC) AS SO_PLANNED_HOURS_DERRIVED_TABLE ON WOL_COOIS_1.SALES_ORD = SO_PLANNED_HOURS_DERRIVED_TABLE.SOPT_SALES_ORD LEFT OUTER JOIN
(SELECT DISTINCT TOP (100) PERCENT WOL_BANK.ORDER_NO, WOL_BANK.PURCHASE_ORDER_NUMBER, WOL_PROJECT_INFO.PROJ_DESCN
FROM WOL_BANK LEFT OUTER JOIN
WOL_PROJECT_INFO ON WOL_BANK.PROJ_NO_8 = WOL_PROJECT_INFO.PLUPS
WHERE (WOL_BANK.ORDER_NO > 2900000000)
ORDER BY WOL_BANK.ORDER_NO) AS UNIT_No_DERRIVED_TABLE ON WOL_COOIS_1.SALES_ORD = UNIT_No_DERRIVED_TABLE.ORDER_NO
GROUP BY WOL_COOIS_1.LEADGORDER, WOL_COOIS_1.PROJ_NO_8, CAST(WOL_COOIS_1.SALES_ORD AS INT32), WOL_COOIS_1.DUMP_DATE, UNIT_No_DERRIVED_TABLE.PURCHASE_ORDER_NUMBER,
UNIT_No_DERRIVED_TABLE.PROJ_DESCN, SO_PLANNED_HOURS_DERRIVED_TABLE.SOPT_STANDARDVALUE
HAVING (CAST(WOL_COOIS_1.SALES_ORD AS INT32) IN (@SALES_ORDER))