July 28, 2006 at 5:30 am
Dear All,
This is a doubt regarding the stored procedures...How do I call a stored procedure inside another stored procedure? If anyone has an idea on this plz do take part...plz reply with ur valuable comments....
Thanks
A Sunil
July 28, 2006 at 6:43 am
Try this..
USE Northwind
GO
CREATE PROCEDURE Proc2 @CustomerID nchar(5)
AS
BEGIN
DECLARE @OrderID int
EXEC Proc1 @CustomerID, @OrderID OUTPUT
SELECT Od.OrderID,
ProductName,
UnitPrice=ROUND(Od.UnitPrice, 2),
Quantity,
Discount=CONVERT(int, Discount * 100),
ExtendedPrice=ROUND(CONVERT(money, Quantity * (1 - Discount) * Od.UnitPrice), 2)
FROM Products P, [Order Details] Od
WHERE Od.ProductID = P.ProductID and Od.OrderID = @OrderID
END
GO
CREATE PROCEDURE Proc1
( @CustomerID nchar(5), @OrderID int OUTPUT )
AS
SELECT TOP 1 @OrderID = OrderID
FROM Orders
WHERE CustomerID = @CustomerID
ORDER BY ShippedDate
GO
Proc2 'VINET'
GO
August 1, 2006 at 5:34 am
Thanks Srikanth
I tried it and it is working...
Regards
A sunil
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply