all groups > sql server reporting services > february 2006 >
You're in the

sql server reporting services

group:

Passing Parameters to ODBC


Passing Parameters to ODBC carolus.holman
2/28/2006 8:39:17 AM
sql server reporting services:
OK, I am trying to pass a comma and quote delimited string to a query,

Example: Select * from myUsers where Userid IN(?)

When I manually type in something like ('1234','4567','2345','9933') for the
parameter directly into the query I get the expected results.

However, when I type the EXACT same string into the Parameter text box on
the Reporting services page I get NOTHING returned. Is this a SECURITY issue?
How can I accomplish this?

Re: Passing Parameters to ODBC Bruce L-C [MVP]
2/28/2006 10:48:47 AM
You cannot do this in RS 2000. In RS 2005 there is the concept of
multi-select combo boxes which allows this type of query.

You would have to do the following (note that once you switch to expression
based query that you will not get any field list returned so make sure first
that you have all the fields showing in the field list).

Go to the generic query designer (the button is to the right of the ...).
You should have a two pane query designer. Then put in this:

="Select * from myUsers where Userid IN(" &
Parameters!YourParameterName.Value & ")"

If you put in '1234','4567','2345','9933' in your parameter then this will
work. Note that parameter names are case sensitive.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: Passing Parameters to ODBC Amarnath
3/1/2006 4:30:27 AM
Hi,

Yes it is possible in RS 2000 as well. A very small round about solutions is
there. I tried it in 2K & 2k5 it works fine. Infact I wanted the same thing
in one of my reports and I found out one. here it goes.

you need to build the string and use sp_executesql to execute the same.

In your "data" tab paste this code

SET QUOTED_IDENTIFIER OFF
declare @str as nvarchar(1000)
set @str = "select * from employee where emp_no in (" + @emp + ")"
execute sp_executesql @str

Now the first line is for removing the confusion of double quotes and
single quotes which comes from the entry ie '1' or 1 etc..

In the layout you wont get to see the fields which you want to place. Just
click add and select database field and type the same name as your fields and
create all the fields which you want to place.
Just preview and enter multiple values. etc... 1,2,3

Try now. it will work.
any problem let me know.

Amarnath



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