[英]Configure dynamic stored procedure with ssrs reports
I have the following SP 我有以下SP
CREATE PROCEDURE Studentrocedure @Type varchar(50) 创建过程Studentrocedure @Type varchar(50)
AS
BEGIN
If @Type = 'Student'
Select * from tblStudent
Else If @Type = 'Fee'
Select * from tblFee
End
END
The problem I'm having is that when I add a DataSet for a SSRS report, it pulls no fields/columns in the Fields section. 我遇到的问题是,当我为SSRS报表添加数据集时,它没有在“字段”部分中提取任何字段/列。
How can I resolve that? 我该如何解决?
ELSE
part, it should be ELSE IF
. ELSE
部分附近的语法错误,应该是ELSE IF
。 End
in the query 也不需要查询中的多余End
*
explicitly mention the column names 代替*
明确提及列名 CREATE PROCEDURE Studentrocedure
@Type varchar(50)
AS
BEGIN
IF @Type = 'Student'
Select * from tblStudent
ELSE IF @Type = 'Fee'
Select * from tblFee
END
You really can't resolve this assuming that your select * queries return different result sets. 假设您的select *查询返回不同的结果集,您真的无法解决此问题。 A dataset requires a deterministic set of fields. 数据集需要确定性的字段集。 You can not dynamically determine the fields that will be included in a dataset. 您无法动态确定将包含在数据集中的字段。
If you are confident that your dynamically selected results will always and forever return the same set of columns regardless of the input given then you can explore using FMTONLY option. 如果您确信无论选择什么输入,动态选择的结果将始终返回永远相同的列集,则可以使用FMTONLY选项进行探索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.