ssrs查询参数工作不正常

zed5wv10  于 2021-07-26  发布在  Java
关注(0)|答案(1)|浏览(321)

我有4个参数在我的ssrs报告数据正在捕获与sp

ALTER PROCEDURE [adjuster].[rpt_HIIGAdjusterLicense]
@Adjustername varchar (max),
@State char (3),
@LicenseStatus char (3),
@RenewalNotAllowed varchar (5)
AS BEGIN(
SELECT  
 FirstName +' '+ LastName as AdjusterName ,
 StateLicense,
 LicenseNumber,
 LicenseStatus,
 ExpirationDate,
 RenewalNotAllowed,
 NPN
FROM adjuster.vw_HIIGAdjusterLicense   
Where ( FirstName LIKE (CASE WHEN @Adjustername IS NULL THEN FirstName ELSE @Adjustername + '%' END))
OR  (@State = 'ALL'  OR @State IN (SELECT Value FROM dbo.FnSplit(@State, ',')))
OR ( @LicenseStatus = 'ALL' OR @LicenseStatus   IN (SELECT Value FROM dbo.FnSplit(@LicenseStatus, ',')))
AND  (@RenewalNotAllowed = 'ALL' OR @RenewalNotAllowed IN (SELECT Value FROM dbo.FnSplit(@RenewalNotAllowed, ',')))
)
END

GO

参数数据集是

SELECT DISTINCT 2 AS Priority, LicenseStatus
FROM            vw_License
UNION ALL
SELECT        1 AS Priority, 'ALL' AS Choice
ORDER BY Priority, LicenseStatus

SELECT DISTINCT 2 AS Priority, StateLicense
FROM            vw_License
UNION ALL
SELECT        1 AS Priority, 'ALL' AS Choice
ORDER BY Priority, StateLicense

SELECT DISTINCT 2 AS Priority, RenewalNotAllowed
FROM            LicenseDetail
UNION ALL
SELECT        1 AS Priority, 'ALL' AS Choice
ORDER BY Priority, RenewalNotAllowed

在ssrs中,当名称值为'null'时,状态值为'all',状态值为'all',续订不允许值为'n'。报告仍显示“y”值为renewalnotallowed的记录。
但is应显示具有“n”值的记录,以供续订不允许。请参考下图

p3rjfoxz

p3rjfoxz1#

更换外罩 OR @state和@licensestatus的where子句中的 AND s
当前如果 @State 那么“all”是你的第二行吗 WHERE 子句的计算结果为 True 所以每一行都会被返回。

相关问题