SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Stored Procedure to run one SP, if no data found run a second SP
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 10/21/2002 :  08:32:24  Show Profile  Visit AskSQLTeam's Homepage
Paul writes "Hi guys

I have an eCommerce system that currently uses an inefficient query to link a products table to a table of discounts which relate to a group of products for each customer and calculates their net price.

The owner now wants to include a second discount structure which can link some (or maybe all) of the products (over 34000!!!) with a customer to get a special discount, but will retain the previous grouped discounts.

I have the system interrogating fairly well by first searching the products table for a description or part number, the customer clicks on the one he wants and gets a more details page which displays his net price - the page first runs a query against the partnumber discounts table, if nothing is found is displays the results of the group discount search which will always have a result. I use this method as otherwise an enormous array is needed to hold a correlation between each products unique key, the customer key, and the discount value from each of the two discount tables.

My problem is the owner wants the net price displayed on the first search results page. I have created four stored procedures which return results fairly quickly on their own, but they need to be paired to get one result set on my display page. What I need is a search for a partnumber discount, more often than not there won't be a result so I need the second query/SP to run to find the group discounted price. How do I get a stored procedure to run the first query, stop if it finds results and display its cursor, or run the second query and use its cursor?

HELP!!!"

ValterBorges
Flowing Fount of Yak Knowledge

USA
1429 Posts

Posted - 10/21/2002 :  23:54:15  Show Profile
Please post your tables, some sample data, your queries and the results you expect.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000