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.
| Author |
Topic |
|
pizzojm
Starting Member
20 Posts |
Posted - 2001-12-06 : 14:15:36
|
| Hello- I am writing a stored procedure that gets all current month orders. I want to call another stored procedure from inside my current one that takes the orderID and calculates the handling cost and returns it to the current record set.The SP to get current month order is below:--------------------------------------------CREATE PROCEDURE spGetCurrentMonthOrders@monthPosted INT,@yearPosted INT,@customerID INTASSELECT tblOrders.orderName, tblOrders.orderID, tblOrders.projectNumber, tblOrders.orderAddress1, tblOrders.orderCity, tblOrders.orderState, tblOrders.orderDateFROM tblOrdersWHERE orderFilled=1 AND customerID=@customerID AND orderID IN (select orderID FROM tblBoxes WHERE month(dateShipped)=@monthPosted AND year(dateShipped)=@yearPosted) ORDER BY orderDateGO-----------------------------------------------Any suggestions would be greatly appreciated! Thanks- Joe |
|
|
nizmaylo
Constraint Violating Yak Guru
258 Posts |
Posted - 2001-12-06 : 18:48:38
|
| If you're using SQL Server 2000, write a UDF and call it from within that same SELECT statement.helena |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2001-12-07 : 06:11:23
|
| You can call the stored procedure using a linked server and openquery and use the result as a derived table in your query.Not saying that this is a good way though.==========================================Cursors are useful if you don't know sql.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|