为什么ssrs显示的行数与SSMS不同?

时间:2017-03-02 21:02:21

标签: sql-server tsql reporting-services parameters

我有带参数@IsMatch的SP,它检查是否

ChildPolicyNumberRater <> ChildPolicyNumberIMS

以及允许用户使用WildCard参数的参数@ChildPolicyNumber。

enter image description here

如果我使用参数'No Match'在SSMS中运行SP,则会为我提供正确的数据ChildPolicyNumberRater NULLS以及与ChildPolicyNumberIMS不匹配的数据:

enter image description here

但是如果我在SSRS中运行它,它只会显示ChildPolicyNumber NULLS的记录。

我确信我WHERE子句中的某些内容使得SSRS显示数据与SSMS不同。但我不明白为什么!

enter image description here

 ALTER PROCEDURE MyProcedure 
            @DateFrom datetime = '2017-01-30'
            @DateTo datetime = '2017-03-05'
            @lineGuid  varchar(8000) = NULL, 
            @IsMatch varchar(50),
            @ChildPolicyNumber varchar(50)

    AS
    DECLARE @TempData
    INSERT INTO @TempData
    SELECT ...
    FROM...
    WHERE 

    SELECT 
            ChildPolicyNumberIMS
            ,ChildPolicyNumberRater
            ,case when ChildPolicyNumberRater <> ChildPolicyNumberIMS or  ChildPolicyNumberRater is null then 1 else 0 end as status
            ,MAX([InvoiceDate]) as InvoiceDate
            ,[CompanyGUID]
    WHERE 
              (

            ChildPolicyNumberRater like '%'+ @ChildPolicyNumber +'%'
            or ChildPolicyNumberRater is null
            or @ChildPolicyNumber   is null
            )
        and (
                    (@IsMatch = 'No Match'
                        and ChildPolicyNumberRater<>ChildPolicyNumberIMS or ChildPolicyNumberRater is null)

                or(@IsMatch = 'Match' and ChildPolicyNumberRater=ChildPolicyNumberIMS)

            ) 

1 个答案:

答案 0 :(得分:1)

在SSRS屏幕截图中,下拉列表显示&#34; Not Match&#34;而不是&#34;没有匹配&#34;。你确定要发送不匹配吗?