Click here to Skip to main content
15,127,128 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a stored procedure having parameter of type var char which will be used to retrieve information of table based on id that id has multiple values separated with commas.

I would like to get the output based on ids.

Is any one can help me to find the answer for me.

My table conatins packageid int(11)

in my stored procedure Iam retrieving like

create procedure getpackage(_PackageId varchar(50))
select * from tbl_Package where packageid in(_PackageId);

How to resolve this problem
Member 9762654 17-Apr-13 0:03am
are you using php as front end?
swathi vadapalli 17-Apr-13 5:20am
am using as front end

1 solution

u dont pass your id as varchar from front end. for example if your id is 1,2,3 then split that as int array say a[0]=1, a[1]=2, and a[2]=3 then pass that to your procedure and retrieve values. I think this will help
swathi vadapalli 17-Apr-13 5:22am
I want to send all the id's at a time
Why I need to send request to server every time and get response
I think It will be burden on server
swathi vadapalli 17-Apr-13 5:43am
Hi All
I found the solution
thank u for your response

the solution is

using find_in_set()

SELECT * FROM tbl_Package
WHERE FIND_IN_SET(packageid , _PackageId)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900