我有一个简单的参数weekEndingDate,由我的dataset提供

SELECT TOP (8) Convert(Date,FullDate, 101) AS FullDate
FROM DimDate
WHERE (DayNameOfWeek = 'Friday') AND (CAST(FullDate AS Date) < CAST(GETDATE() AS Date))
ORDER BY FullDate DESC
我也尝试过
SELECT TOP (8) CAST(FullDate as Date) AS FullDate
FROM DimDate
WHERE (DayNameOfWeek = 'Friday') AND (CAST(FullDate AS Date) < CAST(GETDATE() AS Date))
ORDER BY FullDate DESC

如果我在查询设计器中执行查询,我会得到基本正确的输出(转换为我提供了m/dd/yyyy,而不是mm/dd/yyyy),这对于强制转换和转换是正确的,但是参数下拉列表仍有时间,并且如果我将参数放入细胞,它也有时间

在所有情况下,时间仍然存在,我感到震惊,感谢所有帮助,我很高兴澄清任何事情

最佳答案

尝试将“参数数据类型”设置为“文本”,而不是“日期/时间”。

同样需要更改数据集以返回varchar

最终数据集代码:

SELECT TOP (8) CAST(CONVERT(Date, FullDate, 101)as VARCHAR) AS FullDate
FROM DimDate
WHERE (DayNameOfWeek = 'Friday') AND (CAST(FullDate AS Date) < CAST(GETDATE() AS Date))
ORDER BY FullDate DESC

关于tsql - 从SSRS日期参数中删除时间,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31877897/

10-11 21:39