Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Return single value from stored procedure select?

Author  Topic 

Drew Black
Starting Member

2 Posts

Posted - 2001-05-23 : 23:33:56
I know this is impossible (and improper syntax) but I'm trying to figure out a way to accomplish have the results of a stored procedure included in a select list.

select a.item1, a.item2, b.item1 from products a, pricing b where b.item1 = (spGetPrice a.item1, customerID)

the procedure spGetPrice returns the price for this item for the specific customer based on current sales, discounts, etc.

basically, spgetPrice is SP filled with custom business logic for customer-specific special pricing calculations used with bulk discounts, promotions, coupons etc. The logic is already built into the a stored procedure. I thought about using a view to accomplish the desired effect but throught there might be an easier way becuase all of the custom business logic is alrady encapsulated in one handy stored procedure.

A more general question would be is is possible to execute a stored procedure from within a select statement and use its results in a join?


   

- Advertisement -