Advertisement

02.21.2002 at 03:28PM PST, ID: 20269705
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

CF & SQL Srvr - Call SP with list have SQL use IN @thelist

Asked by brandonrice in ColdFusion Application Server

Tags: , , ,

Essentially i have a group of checkboxes that have the same name.  I want to pull the records back from the database based on what boxes the user clicks, ie one or more than one box...but i cant figure out how to pass the comma delimited form variable to the stored procedure and have the stored procedure process the WHERE ... IN statement.

I want to have the stored procedure return records if the form were to pass in a "t" for searchlist or "t,b" for search list.  It seems to work ok if just the "t" is sent in, but the stored procedure does not work if the comma delimited list is passed in.  To use the IN keyword in SQL it needs to look like this:

WHERE   thetable.thefield IN ( 't', 'b')

but i cannot get the passed in parameter to work.  

I tried to do this in the stored procedure but its not reading it in the statement correctly.

IF @searchlist = 't,b'
BEGIN
     select @searchlist = " 't' , 'b' "
END

The t, and b are coming from checkboxes that have the same name, and therefore I want to pull all the records for the checked boxes.

it seems the double quotes are throwing it off


*** ColdFusion Stored procedure call: ***
<cfstoredproc procedure="sp_search">
     <CFPROCPARAM type="IN" cfsqltype="CF_SQL_VARCHAR" value=#Form.mylist# dbvarname="@searchlist">
</cfstoredproc>


*** SQL Stored Proc: ***
CREATE PROCEDURE sp_search
@searchlist varchar(100)
AS
DECLARE @err_msg varchar(100)

SELECT     *
FROM       thetable
WHERE   thetable.thefield IN ( @searchlist)  
     
RETURN(0)
GO

SQL Table [thetable]:
thefield  varchar(1) possible values [t,b,v]Start Free Trial
[+][-]02.22.2002 at 12:22AM PST, ID: 6818455

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.22.2002 at 10:47AM PST, ID: 6819633

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.22.2002 at 12:48PM PST, ID: 6819893

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.22.2002 at 04:04PM PST, ID: 6820244

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: ColdFusion Application Server
Tags: coldfusion, sql, list, call
Sign Up Now!
Solution Provided By: UncleMatt
Participating Experts: 4
Solution Grade: A
 
 
[+][-]02.23.2002 at 10:22AM PST, ID: 6821178

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.25.2002 at 05:58AM PST, ID: 6824553

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2002 at 07:44PM PST, ID: 6843361

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.05.2002 at 07:46PM PST, ID: 6843367

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32