Groups | Blog | Home
all groups > sql server reporting services > november 2005 >

sql server reporting services : Named and UnNamed parameters


Vinny Vinn
11/15/2005 8:17:05 AM
While creating a report i am running into a problem with parameters.
When building the query i would like to use the same parameter more then
once.
for instance :

select *
from table
where field = @parameter1
and field = @Parameter1
and field = @parameter1

I can runs this Query successfully in the Data tab of the report .however
when i go to the layout or preview tab i get the following error:
The data extension ODBC does not support named parameters. use unnamed
parameters instead.

If i run the query using ? as the parameter i dont have any problems.However
for each ? parameter the user is prompted to supply a value.This is
unacceptable as the user would have to enter the same value numerous times.

select *
from table
where field = ?
and field = ?
and field = ?

Any help would be appreciated.

TIA,
Vinny Vinn
11/15/2005 9:03:02 AM
Thank you ,that what i needed.

[quoted text, click to view]
Bruce L-C [MVP]
11/15/2005 10:47:08 AM
There are query parameters and report parameters. RS automatically creates
the report parameters for you. It will create a report parameter for each
unnammed parameter. What you need to do is map each query parameter to a
single report parameter. In the data tab click on the ..., parameters tab.
Map each ? on the left to the same report parameter on the right. Next go to
the layout, report->report parameters and remove the extra unused report
parameters.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

MJT
1/26/2006 10:17:03 AM
Bruce,
I am using DB2 so I also have to use unnamed parms in my queries. I have
used your solution for parms that need entries on the report. However - that
doesnt solve the problem that the query on the data tab still has 10 question
marks in it and it would be really helpful to those that have to modify
"others" reports to not have to try and play "match the parameter" ... Is
there a way to place a comment in the query tab? that might be helpful
enough. Thanks! I am posting a much larger ISSUE about dealing with parms
syntax when I need to code the sql as an expression ... please see Parm
Syntax for SQL Expression

[quoted text, click to view]
AddThis Social Bookmark Button