我在 SQL 端的 SSRS2017 中有一个报告我有一个参数过滤器,因为它可以包含多个值,它设置为“in(@SALES_ORDER)”值。我有 2 个派生表加入到我的主表中,1 个在销售订单号上,另一个在生产订单号上,运行时我收到注明的“SQL 执行错误。我无法弄清楚为什么会收到错误,我相信它关于销售订单号 “COOIS”和 UNIT_NO DERR 表中销售订单号的数据类型为“BIGINT”
我尝试在每个实例中都“CAST (FIELD NAME AS 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))