简体   繁体   English

SSRS 日期参数未显示正确日期

[英]SSRS Date Parameters not displaying correct dates

I have a report with a couple date parameters called fromDate and toDate.我有一个带有两个日期参数的报告,称为 fromDate 和 toDate。 The report tablix property is set to filter fromDate >= date and toDate <= date.报表 tablix 属性设置为过滤 fromDate >= date 和 toDate <= date。 However, when I run the report let's say with the fromDate 19-12-2020 and the same date in toDate 19-12-2020 it won't display anything.但是,当我运行报告时,假设 fromDate 19-12-2020 和 toDate 19-12-2020 中的相同日期不会显示任何内容。 To get the 19th I'd have to select a day over like 20-12-2020 and this won't display data for the 20th as well.要获得 19 日,我必须像 2020 年 12 月 20 日那样每天到达 select,这也不会显示 20 日的数据。 Has anyone else encountered this problem?有没有其他人遇到过这个问题? How can I fix this bug?我该如何修复这个错误? Any help will be appreciated, thanks in advance.任何帮助将不胜感激,在此先感谢。

Since your Date column from your source table is date time like -由于源表中的日期列是日期时间,例如 -

2018-01-31 19:16:07.000 2018-01-31 19:16:07.000

and your parameters that are date time will be sending this -并且您的日期时间参数将发送此-

2018-01-31 00:00:00.000 2018-01-31 00:00:00.000

.. no records will be returned.. Unless you have exactly 00:00:00.000 as your minutes and hours. .. 不会返回任何记录.. 除非您的分钟和小时正好是 00:00:00.000。

You need to convert your column to date in your where clause like this:您需要在 where 子句中将列转换为日期,如下所示:

where convert(date,yourtable.yourcolumn) between @start_date and @end_date

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM