我有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”值的记录,以供续订不允许。请参考下图
1条答案
按热度按时间p3rjfoxz1#
更换外罩
OR
@state和@licensestatus的where子句中的AND
s当前如果
@State
那么“all”是你的第二行吗WHERE
子句的计算结果为True
所以每一行都会被返回。