Advertisement

05.29.2007 at 05:52PM PDT, ID: 22601055
[x]
Attachment Details

Need help

Asked by lpenrod in SQL Server 2005, MS SQL Server

Tags: sp_search

Not sure how to do this...

I have a stored procedure that is similar to this:

Create Procedure sp_search
      (@search_items varchar(50),
      @price1 decimal(9,2),
      @price2 decimal(9,2),
      @method varchar(10))
AS


I am not sure to how handle this.

If @method has no value then I want this search:
select * from product where CONTAINS(csearch_items,@search_items)

If @method has the value 'equal' then I want this search:
select * from product where CONTAINS(csearch_items,@search_items) AND price = @price1

If @method has the value 'greater' then I want this search:
select * from product where CONTAINS(csearch_items,@search_items) AND price > @price1

If @method has the value 'less' then I want this search:
select * from product where CONTAINS(csearch_items,@search_items) AND price < @price1

If @method has the value 'range' then I want this search:
select * from product where CONTAINS(csearch_items,@search_items) AND ((price > @price1) AND (price < @price2))Start Free Trial
[+][-]05.29.2007 at 05:59PM PDT, ID: 19176655

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.

 
[+][-]05.29.2007 at 06:00PM PDT, ID: 19176660

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

Zones: SQL Server 2005, MS SQL Server
Tags: sp_search
Sign Up Now!
Solution Provided By: appari
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.29.2007 at 07:36PM PDT, ID: 19176996

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.

 
[+][-]05.30.2007 at 02:01AM PDT, ID: 19178223

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.

 
[+][-]05.30.2007 at 04:51PM PDT, ID: 19184534

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.

 
[+][-]05.30.2007 at 04:55PM PDT, ID: 19184563

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.

 
[+][-]05.30.2007 at 05:00PM PDT, ID: 19184597

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.

 
[+][-]05.30.2007 at 05:07PM PDT, ID: 19184633

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.

 
[+][-]05.30.2007 at 05:11PM PDT, ID: 19184646

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