从 SSRS 日期参数中删除时间
Remove Time From SSRS Date Parameter
I want to remove the time from my Parameter Selection Dropdown, NOT a cell referencing the parameter
我有一个简单的参数 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
The issue is that the parameter options still display time.
如果我在查询设计器中执行查询,我得到基本上正确的输出(Convert 给我 m/dd/yyyy
,而不是 mm/dd/yyyy
),这对于转换和转换是正确的,但参数下降down还有时间,如果我把参数放到cell里,它也有时间
I have deleted the .data files
I have deleted and recreated the parameter, but did not deploy or rebuild or anything WITHOUT the parameter, I deleted and immediately recreated then hit Preview
I have tried both CAST and CONVERT
I have tried Previewing, Running, and Deploying the report
在所有情况下,时间都剩下了,我傻眼了,感谢大家的帮助,我很乐意澄清任何事情
在 SQL Server Business Intelligence Development Studio 或 Report Builder3.0 中打开您的报表。
单击“设计”选项卡,右键单击将显示@Time 参数的文本框,select 表达式。
清除表达式对话框,然后输入:
=FormatDateTime(参数!Timer.Value, DateFormat.ShortDate) 或 =FormatDateTime(参数!Timer.Value,2).
尝试将参数数据类型设置为文本而不是 Date/Time。
还需要将数据集更改为 return 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
I want to remove the time from my Parameter Selection Dropdown, NOT a cell referencing the parameter
我有一个简单的参数 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
The issue is that the parameter options still display time.
如果我在查询设计器中执行查询,我得到基本上正确的输出(Convert 给我 m/dd/yyyy
,而不是 mm/dd/yyyy
),这对于转换和转换是正确的,但参数下降down还有时间,如果我把参数放到cell里,它也有时间
I have deleted the .data files
I have deleted and recreated the parameter, but did not deploy or rebuild or anything WITHOUT the parameter, I deleted and immediately recreated then hit Preview
I have tried both CAST and CONVERT
I have tried Previewing, Running, and Deploying the report
在所有情况下,时间都剩下了,我傻眼了,感谢大家的帮助,我很乐意澄清任何事情
在 SQL Server Business Intelligence Development Studio 或 Report Builder3.0 中打开您的报表。
单击“设计”选项卡,右键单击将显示@Time 参数的文本框,select 表达式。
清除表达式对话框,然后输入:
=FormatDateTime(参数!Timer.Value, DateFormat.ShortDate) 或 =FormatDateTime(参数!Timer.Value,2).
尝试将参数数据类型设置为文本而不是 Date/Time。
还需要将数据集更改为 return 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