Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Parameter Selections to a Stored Procedure

Status
Not open for further replies.

jlopeman

IS-IT--Management
Apr 25, 2011
35
I have a CR XI report that utilizes a stored procedure (MSSQL 2005) to gets a dataset that is not returning the expected data. I know why, but not sure the best route to fix.

The main report has 3 parameters to pass to the SP: location, startDate, and endDate. The subreport is linked to these parameters (subreport is working fine, but mentioned for contextual reasons). Currently, the user can choose more than one location, but the report only returns data for one of the locations, based on locationName

In looking at the stored procedure, it only accepts (@start datetime, @End datetime, @location varchar(40))

I'm not a SQL expert, but how can I change @location varchar into something that will accept more than 1 location? Will that even work?

 
Hi,
You can set the @location parameter to accept multiple values and in your SP use an IN operator to check them ( a multi-value parameter creates an array of the values entered, so your SQL may need to handle parsing that array, depending on MSSQL's IN operator abilities)

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top