M
martinharvey via DotNetMonster.com
This is probably a very simple question but i am having problems with a
stored procedure syntax.
I want to insert into a Datatable ("Orders") "Name" and "Address" from a
datatable called "customer"
with the parameters customerId = @CustomerId
I also want to insert into the same Datatable ("orders") at the same time
"Name" and "Cost"
from a datatable called "products". The input parameter for this is cartID =
@cartId
I have tried this but it doesnt seem to work. Can anyone tell me where i am
going wrong.
CREATE PROCEDURE SP_CreateOrder
(@CustomerID Varchar (50), @CartID Char (36))
AS
INSERT INTO Orders (Name, Address, Name, Cost)
SELECT customer.Name, customer.Address, products.Name, products.Cost
FROM Customer AND Products Join ShoppingCart ON Products.ProductID =
ShoppingCart.ProductID
WHERE ShoppingCart.CartID = @CartID AND customerId = @CustomerId
stored procedure syntax.
I want to insert into a Datatable ("Orders") "Name" and "Address" from a
datatable called "customer"
with the parameters customerId = @CustomerId
I also want to insert into the same Datatable ("orders") at the same time
"Name" and "Cost"
from a datatable called "products". The input parameter for this is cartID =
@cartId
I have tried this but it doesnt seem to work. Can anyone tell me where i am
going wrong.
CREATE PROCEDURE SP_CreateOrder
(@CustomerID Varchar (50), @CartID Char (36))
AS
INSERT INTO Orders (Name, Address, Name, Cost)
SELECT customer.Name, customer.Address, products.Name, products.Cost
FROM Customer AND Products Join ShoppingCart ON Products.ProductID =
ShoppingCart.ProductID
WHERE ShoppingCart.CartID = @CartID AND customerId = @CustomerId