Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在RDL中不向日期时间数据类型传递任何内容(空值)_Sql_Sql Server_Reporting Services_Ssrs 2012 - Fatal编程技术网

Sql 如何在RDL中不向日期时间数据类型传递任何内容(空值)

Sql 如何在RDL中不向日期时间数据类型传递任何内容(空值),sql,sql-server,reporting-services,ssrs-2012,Sql,Sql Server,Reporting Services,Ssrs 2012,如何在RDL中为日期时间数据类型指定空值。我正在尝试以下内容,但我将01/01/00发送到那些没有任何数据的行 =iif(Fields!D_date.Value is nothing,Nothing,Fields!D_date.Value) 即使我使用 =iif(Fields!D_date.Value=0,Nothing,Fields!D_date.Value) 或 我的数据行中出现错误 我正在进入存储过程。如果没有该列的数据 这是我正在使用的存储过程: SET ANSI_NULLS

如何在RDL中为日期时间数据类型指定空值。我正在尝试以下内容,但我将01/01/00发送到那些没有任何数据的行

 =iif(Fields!D_date.Value is nothing,Nothing,Fields!D_date.Value)
即使我使用

 =iif(Fields!D_date.Value=0,Nothing,Fields!D_date.Value) 

我的数据行中出现错误

我正在进入存储过程。如果没有该列的数据

这是我正在使用的存储过程:

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

ALTER PROCEDURE [dbo].[uspDBLines]
    (@InLinesPerPage int)
AS
    DECLARE @TotalRows int
    DECLARE @Remainder int
    DECLARE @NumPages int
    DECLARE @NextPageRows int

    SET @TotalRows = 0

    SELECT 
        ROW_NUMBER() OVER (ORDER BY P_id) AS InvoiceRow,
        CusID, B_id, Inv_No, B_Desc, D_date, Qty, Size, Price, Amt
    INTO
        #tempInvoice
    FROM 
        Purchase_Details

    SET @TotalRows = @@ROWCOUNT

    IF @TotalRows = 0
    BEGIN
        WHILE @TotalRows < @InLinesPerPage -- Add Blank Rows will generate blank invoice.
        BEGIN
            SET @TotalRows = @TotalRows + 1

            INSERT INTO #tempInvoice (InvoiceRow, CusID, B_id, Inv_No, B_Desc, D_date, Qty, Size, Price, Amt)
            VALUES (@TotalRows, '', '', 0, '', '', 0, '', 0, 0)
        END
    END
    ELSE
    BEGIN
        SET @Remainder = @TotalRows % @InLinesPerPage -- get remainder

        IF @Remainder != 0 
        BEGIN
            -- Get the current page increase by 1 because we have a remainder.
            SET @NumPages = @TotalRows / @InLinesPerPage + 1 
            SET @NextPageRows = @NumPages * @InLinesPerPage

            WHILE @TotalRows < @NextPageRows -- Add Blank Rows
            BEGIN
                SET @TotalRows = @TotalRows + 1

                INSERT INTO #tempInvoice (InvoiceRow, CusID, B_id, Inv_No, B_Desc, D_date, Qty, Size, Price, Amt)
                VALUES (@TotalRows, '', '', 0, '', '', 0, '', 0, 0)
            END
        END
    END

    SELECT * 
    FROM #tempInvoice 
    ORDER BY InvoiceRow ASC

    RETURN

对于所有无效日期,表中很可能会填入类似1900年1月1日的日期。因此,报告只是显示存在的内容,因为它们不是空的

所以试试这个表达:

=IIf(Fields!D_date.Value <= CDate("1/1/1900"), Nothing, Fields!D_date.Value)

SSRS不使用is运算符与Nothing进行比较。

您是否尝试过NULL或空字符串我在RDL中给出空字符串时出错。我在表达式中尝试了NULL,intellisense不允许传递。您如何处理该值?你在别的地方用过吗?RDL不应该对just=字段有任何问题!D_日期值。如果emptyNo,则将NULL放在存储的进程中,我只使用它来显示数据。我尝试在SP内部进行更改。当我在表达式中使用NULL时,此错误NULL未声明,不受支持,而是使用System.DB.NULL在存储的Proc和=字段上返回NULL!RDL上的D_date.Value应该可以正常工作。如果没有,请检查SP返回的内容
=IIf(Fields!D_date.Value <= CDate("1/1/1900"), Nothing, Fields!D_date.Value)
    =IIf(Fields!D_date.Value = Nothing, Nothing, Fields!D_date.Value)