directxBOB
asked on
Copying a Row?
I have an Orders Table and I would like to copy an Order and assign it to another Order.
The only thing that would be required to changed would be the field CustomerID where I would change the customerID for that order.
The obvious approach would be to copy out all the fields from the order and insert it into the new row. But is there anyway automate this so it automatically does the insert and update for me?
The only thing that would be required to changed would be the field CustomerID where I would change the customerID for that order.
The obvious approach would be to copy out all the fields from the order and insert it into the new row. But is there anyway automate this so it automatically does the insert and update for me?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
actually, the example was not really "speaking"..
you will need to insert into and query more of the "order_Table" columns, but as I don't know your table/column names...
you will need to insert into and query more of the "order_Table" columns, but as I don't know your table/column names...
ASKER
Yes I understood that part but I wasn't really sure about:
SELECT 2, getdate()
SELECT 2, getdate()
2 would be the new customerid, and getdate() as "new" order date for the new rows..
ASKER
Mainly :
SELECT 2, getdate()
FROM order_table
WHERE CustomerID = 1
AND OrderID = 123456