Friday, March 30, 2012

Report Parameter in SELECT

I have a report parameter (called Column) that I would like
incorporated in the SELECT Statement. For example, the select is :
SELECT @.Column AS Expr1 FROM Table
The report runs after I select the appropriate value for the parameter,
but I do not get the correct data. If I select Test for the column
parameter, then Test appears for the value in the report--instead of
the correct data.
Does anyone know if building a dynamic column select statement is
possible like this?You have to create an expression for the SQL.
= "Select " & Parameters!Paramname.Value & " as Expr1 from Table"
Be sure you have your field list already because RS will not be able to
detect the fields for you once you use an expression.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Aaron" <aaron.heller@.gmail.com> wrote in message
news:1139495719.116692.50590@.g47g2000cwa.googlegroups.com...
>I have a report parameter (called Column) that I would like
> incorporated in the SELECT Statement. For example, the select is :
> SELECT @.Column AS Expr1 FROM Table
> The report runs after I select the appropriate value for the parameter,
> but I do not get the correct data. If I select Test for the column
> parameter, then Test appears for the value in the report--instead of
> the correct data.
> Does anyone know if building a dynamic column select statement is
> possible like this?
>

No comments:

Post a Comment