Reputation: 155
the result of a stored procedure returns a number of cities
I wrote this stored procedure to get the data of any column to show them in ssrs report
here is the stored procedure
Alter PROCEDURE get_acc_Account_report @Variable NVARCHAR(max)
AS
BEGIN
DECLARE @SQL NVARCHAR(max);
SET @SQL = 'Select '+ @Variable + ' From Acc_Account'
PRINT @SQL
EXEC sp_executesql @SQL
END
Then I created a new report in the report builder that contains the dataset of this stored procedure,
How can I show the return data of the selected column of the returned Variable I write in the columns.
E.G.:- I wrote this Expression
=Parameters!Variable.Value
but It was right to return me 'City' Column and it is true, any recommendation for a solution?
Upvotes: 0
Views: 415
Reputation: 10066
You have to create a static alias for your column in your procedure query.
SET @SQL = 'Select '+ @Variable + ' AS mycolumn From Acc_Account'
Then use the column alias as the field name of your dataset e.g.
=Fields!mycolumn.Value
Upvotes: 1