gpt4 book ai didi

sql-server - Sql Server Reporting Services 必须声明标量变量 @param

转载 作者:行者123 更新时间:2023-12-03 02:46:53 24 4
gpt4 key购买 nike

我有一个 Sql Server 报告服务项目。我有一个名为 Total 的数据集查询,其中我根据参数选择某些数据:

select ...
from ...
group by ...

having prop_id = @PropID

现在,为了填充此参数的多个值的列表,我有一个名为 AllProps 的数据集查询,它选择所有可能的 prop_id:

select prop_id from proposal
order by prop_id

现在,在报告数据 Pane 中,我从 @PropID 选择参数属性并填写如下表格:

Under General I have,
Name: PropID
Data type: Text
(I select "Allow multiple values")

Under Available values I have,
Get values from a query
Dataset: AllProps
Value Fields: prop_id
label field: prop_id

Under Default Values I have,
Get values from a query
Dataset: AllProps
Valuefield: prop_id

当我单击预览选项卡查看我的报告时,出现以下错误:

本地报告处理期间发生错误。报告处理期间发生错误。数据集“Total”的查询执行失败。

必须声明标量变量“@PropID”。

我哪里出错了? SSRS 中什么是标量变量以及如何正确使用它?

谢谢

最佳答案

您编写的查询需要更正。由于您选择了多个值,因此需要使用 in 子句。

Select col1,col2....
from TableName
where prop_id in (@PropID)

关于sql-server - Sql Server Reporting Services 必须声明标量变量 @param,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11226894/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com