Welcome to MSDN Blogs Sign in | Join | Help

Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Normally, when you have a dataset query which is filtered by a parameter (like the one below), it's easy to test it in the query design tool:

SELECT field1,field2 FROM table WHERE field3 = @someParameter

...you simply click the "!" button on the toolbar, and a Query Parameter dialog pops up in which you specify the value for @someParameter. However, what can you do if you're using a multi-value parameter and therefore need to provide a set of values:

...WHERE field3 IN (@someParameter)

You might want to pass a series of values, like ('cat', 'dog'), etc. Well, there's unfortunately no good way to do this. The query design tool is based on SQL Server functionality which doesn't natively support multi-value parameters. I guess you could temporarily hard-code a few values directly inside your search condition (IN list), but that's about it. Bummer!

Published Thursday, July 14, 2005 3:01 PM by russch

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Tuesday, May 09, 2006 8:05 AM by dharoun@westend.bm
when I use the above statement I get error in where clause near '@' unable to parse query text?????????????

any idea?

# re: Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Wednesday, May 10, 2006 7:43 AM by russch
You're running into one of two problems:

1. You don't have multi-valued paramters turned on

2. You are trying to preview the result of a query with multi-valued parameters turned on (which the post above says won't work)

# re: Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Wednesday, May 10, 2006 4:50 PM by Ben Sullins
I'm confused about how this is supposed to work. I tried the multi-value parameter being passed to a stored proc but it's not returning anything. When it passes the parameters does it just do it like a string? If so I beleive you would need to do dynamic sql in your query to make it work...

thoguhts?

# re: Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Tuesday, July 18, 2006 2:56 AM by keen
Try this:
WHERE field3 = ?

# re: Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Friday, August 18, 2006 3:06 PM by Peter Budai
Multi-valued parameters can only be used with dynamic text SQL queries in SQL 2005 SSRS. You can get around it using your SP and still using a dynamic query to filter the records with an outer WHERE and the IN (@multiparamname) there.

# re: Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Tuesday, September 12, 2006 3:00 PM by oleg
multi-value parameters are strings.
what is the way to query integer column. Ex:

where cast (EmloyeeID as varchar) in (@MyParam )

doesn't work.

Plese help

# re: Testing dataset queries which utilize multi-value parameters in SQL Server 2005 Reporting Services

Wednesday, December 17, 2008 5:50 AM by Addin

so, how to do pass multivalue parameter without having to type values inside IN ???

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker