Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Norway
    Posts
    6

    Unanswered: How to transfer data from one table to another?

    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!
    Last edited by alshadar; 11-11-03 at 04:02.

  2. #2
    Join Date
    Nov 2003
    Location
    Norway
    Posts
    6
    I helped myself. If I remove the VALUES, and put the SELECT-sentence like this:
    SELECT @OrderID AS OrderID, ProductID, .....

    Jippi )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •