sql-server - SSRS 数据集可以有默认值吗?
问题描述
我的SSRS
报告有一个数据集 ( datasetMacys
),它调用usp_GetStoreSales @Rundate, @StoreName
.
数据集可以有默认值吗?这样报告将只要求一个参数 ( @Rundate
) 并且数据集嵌入了字符串值“Macys”?
换句话说,用户不必为第二个参数选择一个值,因为它已经是该数据集的默认值。
然后,我将添加第二个数据集 ( datasetSears
),其中 @StoreName 的默认值为“Sears”,这意味着它只会使用@Rundate
用户选择的那个。
存储过程看起来像这样,即使问题并不真正需要它:
create procedure usp_GetStoreSales
(
@RunDate date,
@StoreName varchar(10)
)
as
select * from [Sales]
where RunDate = @RunDate and StoreName = @StoreName
我可以通过创建两个不同的存储过程(即usp_GetMacysSales @RunDate
和usp_GetSearsSales @RunDate
)轻松解决这个问题,但这正是我想要避免的。
解决方案
You just need to create your two datasets and then, for each dataset, righ click the dataset name, choose properties, click the parameters tab and overwrite the parameter value for the StoreName parameter.
推荐阅读
- audio - 如何将仅包含音频文件的文件夹拆分为 train 和 test 文件夹
- apache-kafka - 如何在 Kafka 流中使用带有 KTable 的自定义序列化程序?
- python - Telethon 运行一次,名称“未定义主程序”
- c++ - QDir entryList 函数的奇怪行为
- spring - Spring框架5.3.4兼容哪个版本的Spring框架安全
- pycharm - Pycharm的颜色选择器
- jenkins - 在 Jenkins Build with parameters 选项中选择选项时如何启用参数
- python - 为什么 Python 循环内部计时比外部循环计时更快?
- vue.js - 如何在 nuxt 中向 element-ui 添加自定义主题?
- excel - 带有标题的列的 VBA_Offset