send multiple values to SP

S

shank

I have a stored procedure that requires one variable to be filled: WHERE
ItemNo = @ItemNo
Instead of sending 1 value, I'd like to send a bunch of values.
I don't mind changing the SP if I new how to approach this.
The user would select any number of ItemNo's from a form and submit.
Assume ItemNo's like: B1, B2, B3, etc...
The end result would be something like ...
WHERE ItemNo = B1 or ItemNo = B5 or ItemNo = B10 ...etc....

I want to build a recordset based on the user's selections.
How?

thanks!
 
B

Bob Barrows [MVP]

shank said:
I have a stored procedure that requires one variable to be filled:
WHERE ItemNo = @ItemNo
Instead of sending 1 value, I'd like to send a bunch of values.
I don't mind changing the SP if I new how to approach this.
The user would select any number of ItemNo's from a form and submit.
Assume ItemNo's like: B1, B2, B3, etc...
The end result would be something like ...
WHERE ItemNo = B1 or ItemNo = B5 or ItemNo = B10 ...etc....

This article details many alternatives:
http://www.sommarskog.se/arrays-in-sql.html

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top