My table has a large number of columns. I have a command to copy some data – think of it as cloning a product – but as the columns may change in the future, I would like to only select everything from the table and only change the value of one column without having to refer to the rest.
Eg instead of:
INSERT INTO MYTABLE ( SELECT NEW_ID, COLUMN_1, COLUMN_2, COLUMN_3, etc FROM MYTABLE)
I would like something resembling
INSERT INTO MYTABLE ( SELECT * {update this, set ID = NEW_ID} FROM MYTABLE)
Is there a simple way to do this?
This is a DB2 database on an iSeries, but answers for any platform are welcome.
You could do this: