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!

How to pass mutiple-value parameters to a SQL server stored procedure?

Status
Not open for further replies.

lyu

Programmer
Feb 8, 2005
26
0
0
US
Hi,

I use CRXI and Sql Server 2000. I want a report, that users can choose multiple student IDs they want to see, then the report passes these mutliple IDs to a stored procedure as parameters, the sp runs and returns records which are only related to the students the user has chosen.

The difficutly, as I understand, is that a user might choose 1, 2, or any number of student IDs, and a stored procedure cannot take an array as its parameter. Obviosuly, I cannot write endless stored procedure like myProc(studentID1), myProc(studentID1, studentID2)....

I know one solution to that, is to let the sp return all records and let crystal report do the filtering thru "selection expert", however, this is not an ideal solution. We would rather let the database do the filtering, since the data is huge and the sp is very complicated, e.g. it may take 10+ minutes to return all the records, while frequently, a user may only want to see 5-6 records of them.

Can anyone here give me some ideas of how to implemnt it?
I desperately need to get it done. Many Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top