【发布时间】:2018-12-12 17:29:13
【问题描述】:
我试图在 SQL Server Reporting Services 中获取两个日期之间的差异。我有离开日期和下一个到达日期。我在第一个 iif 中使用两个 iif 来计算天数,在第二个 iif 中使用小时、分钟和秒。
=iif(IsNothing(Fields!NextEnterDateTimeUtc.Value)=False,
Floor(DateDiff(DateInterval.Second, Fields!LeaveDateTimeUtc.Value, Fields!NextEnterDateTimeUtc.Value) / 86400)
& iif(Floor((DateDiff(DateInterval.Second, Fields!LeaveDateTimeUtc.Value, Fields!NextEnterDateTimeUtc.Value)) / 86400)=1," day ", " days ") &
Format(DateAdd("s", DateDiff(DateInterval.Second, Fields!LeaveDateTimeUtc.Value, Fields!NextEnterDateTimeUtc.Value), "00:00:00"), "HH:mm:ss")
, "No data")
问题是,在计算之后,当没有 Fields 的数据时!NextEnterDateTimeUtc.Value,我收到错误:Expression The hidden value in the text "Textbox20.Paragraphs [0] .TextRuns [0]" contains an error: An overflow occurred during the arithmetic operation.
【问题讨论】:
-
一些发生错误的示例数据可能会有所帮助
-
当
Fields!LeaveDateTimeUtc.Value1 is 2018-06-08 10:34:15 andFields!NextEnterDateTimeUtc.Value` 是 2018-06-09 20:35:43 时,一切都计算正确。但是当Fields!LeaveDateTimeUtc.Value是 2018-06-09 22:35:44 并且Fields!NextEnterDateTimeUtc.Value是 NULL 我收到错误消息
标签: sql tsql reporting-services