I have a temporary shoppingcart-table that I want to transfer to an OrderDetail-table. See following code:
CREATE PROCEDURE add_orderdetails
@.CartID int,
@.OrderID int
AS
BEGIN TRAN AddOrderDetail
INSERT INTO OrderDetails
(OrderID, ProductID, Quantity, Price)
VALUES
(@.OrderID, SELECT ProductID, Quantity, Price FROM Cart WHERE CartID=@.CartID)
COMMIT TRAN AddOrderDetail
GO
The OrderID and CartID are inputs from an asp-page.
I got an syntax-error near SELECT and ')'.
I hope someone is able to help me with this. I will be very grateful!I helped myself. If I remove the VALUES, and put the SELECT-sentence like this:
SELECT @.OrderID AS OrderID, ProductID, ....
Jippi :o)
Wednesday, March 28, 2012
How to transfer data from one table to another?
Labels:
add_orderdetailscartid,
codecreate,
database,
following,
microsoft,
mysql,
oracle,
orderdetail-table,
procedure,
server,
shoppingcart-table,
sql,
table,
temporary,
transfer
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment