SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 ssrs 2012 pass multivalue parameter to stored proc
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

scamper
Yak Posting Veteran

52 Posts

Posted - 05/07/2014 :  18:26:17  Show Profile  Reply with Quote
In an SSRS 2012 report, I am currently calling a stored procedure called spRoom. I obtain the results of the stored procedure
by creating a temptable called #roomReults

The temp table that I am creating and using to obtain results looks like the following:

CREATE TABLE #roomResults(
studentID VARCHAR(15),
endYear SMALLINT,
calendarID INT)
INSERT #roomResults
EXEC [dbo].[spRoom] @endYear, @calendarID

Currently I am only passing in one value for both paramters called: @endYear and @calendarID. However now I want to pass
in several values to each parameter.

I want to change the sql to look like the following:
EXEC [dbo].[spRoom] IN (@endYear), In (@calendarID)

The above gives me syntax errors.

Thus I am wondering if you can show me how to change the sql listed above so that that I can pass in more than one value from the SSRS report parameters called @endYear and @calendarID to the stored procedure called [spRoom]?

tkizer
Almighty SQL Goddess

USA
36674 Posts

Posted - 05/07/2014 :  18:40:05  Show Profile  Visit tkizer's Homepage  Reply with Quote
You'd have to loop through the rows in your temp table and call the stored procedure for each row in the temp table. Alternatively and better, you should modify spRoom so that it can handle this scenario or create a new with the same concept except that it processes sets instead of one row at a time.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.19 seconds. Powered By: Snitz Forums 2000