reporting-services - How to add Date and Time Parameter for two different days in SSRS
问题描述
I am using SSRS 2012. I have an issue with my date and time parameters.
I in my dataset I have [datetime], [date] and [time] columns, and parameters @fromDate
, @toDate
of datetime data type and @fromtime
, @totime
of text
data type.
It works perfectly until the user chooses the the @totime
to be less the @fromtime
.
Example :
@fromDate = 10/1/2019
@toDate = 11/1/2019
fromtime: 20:00 (which is 10/1/2019)
totime: 06:00 (which should be the next day 11/1/2019)
I get no data in the report and I think because the system understand it as swapping the data which is not equivalent with the query.
Where
F.[Datetime] >= @fromDate
AND F.[Datetime] <= @toDate
AND Em.Name IN (@Name)
AND F.[time] >= @fromtime
AND F.[time] <= @totime
I expect the output to be :
5 row for employee names with the mentioned date and time who get out from 10/1/2019 20:00 to 11/1/2019 06:00 am .
but the actual output was no data.
解决方案
我已经使用了这个声明并且工作得很好。
where datetime >= DATEADD(dd,DATEDIFF(dd,0,@StartDate),@StartTime)
and datetime <=DATEADD(dd,DATEDIFF(dd,0,@EndDate)+1,@EndTime)
问候, 贾米拉
推荐阅读
- python - xmlschema 元素不是架构的元素
- javascript - 使用promise.all 使用rn-fetch-blob 下载图像?
- java - 如何验证休息控制器的参数
- php - 错误 file_get_contents(): 读取 8192 字节失败,errno=21
- javascript - 有人可以解释下面关于 JavaScript 的 concat() 和 slice() 方法的示例吗?
- java - 在多个集合上使用 DocumentDB 更改流?
- r - 比较R中的两行数据框
- javascript - 节点、快递、正文解析器 - 无法从 src 读取 js 文件
- python - 如何对数据框中的每一列进行排名(百分比)?
- javascript - 如何在使用 jQuery 的按钮点击时切换到不同的 python 函数?