Hi, i have this problem
in a stored procedure i have a SELECT statement, and in this SELECT statement another stored procedure should be executed
Is this possible? Cause now i have this and i get 2 errors
CREATE PROCEDURE sp_1
......
......
INSERT INTO OrderItem (OrderID, ProductID, Quantity, Price, Promo)
SELECT @OrderID, ShoppingCartItem.ProductID, ShoppingCartItem.Quantity,
EXEC sp_ProductPrice (ShoppingCartItem.ProductID, @CustomerID),
Product.Promo
FROM ShoppingCartItem
INNER JOIN Product ON ShoppingCartItem.ProductID = Product.ProductID
WHERE CustomerID = @CustomerID
Server: Msg 156, Level 15, State 1, Procedure sp_InsertOrder, Line 18
Incorrect syntax near the keyword 'EXEC'.
Server: Msg 170, Level 15, State 1, Procedure sp_InsertOrder, Line 18
Line 18: Incorrect syntax near 'ShoppingCartItem'.
in a stored procedure i have a SELECT statement, and in this SELECT statement another stored procedure should be executed
Is this possible? Cause now i have this and i get 2 errors
CREATE PROCEDURE sp_1
......
......
INSERT INTO OrderItem (OrderID, ProductID, Quantity, Price, Promo)
SELECT @OrderID, ShoppingCartItem.ProductID, ShoppingCartItem.Quantity,
EXEC sp_ProductPrice (ShoppingCartItem.ProductID, @CustomerID),
Product.Promo
FROM ShoppingCartItem
INNER JOIN Product ON ShoppingCartItem.ProductID = Product.ProductID
WHERE CustomerID = @CustomerID
Server: Msg 156, Level 15, State 1, Procedure sp_InsertOrder, Line 18
Incorrect syntax near the keyword 'EXEC'.
Server: Msg 170, Level 15, State 1, Procedure sp_InsertOrder, Line 18
Line 18: Incorrect syntax near 'ShoppingCartItem'.