This is what I want to do, not sure if
it is possible:
I'd like to run an insert where the column
names inserted into are based on the results
of the query, like this:
create table DETEMP
(product,
name,
quantity,
DE1,
DE2,
DE3);
insert into DETEMP
(product, name, quantity, columnname)
select product,
name,
quantity,
columnname
from SALESDETAIL;
Essentially I want to insert into either DE1, DE2, DE3
depending on the value of the columname column in SALESDETAIL.
Does anyone know of a good way to handle this?
I hope I'm explaining this clearly.
Thanks,
Julien
What do you want to insert into DE1, DE2 or DE3?
You are putting;
product->product
name->name
quantity->quantity
but you haven't explained what it is you want to put into the column
referenced by columname???
Probably ought to put DE1, DE2, and DE3 out in their own table, linking
back to DETEMP via foreign key constraint, especially if your products
may have a variable number of DEn values.
--
79. If my doomsday device happens to come with a reverse switch, as soon as it
has been employed it will be melted down and made into limited-edition
commemorative coins.
--Peter Anspach's list of things to do as an Evil Overlord