Is there any way to simplify a verbose SQL INSERT INTO(..) query?

Posted by Soundar Rajan on Stack Overflow See other posts from Stack Overflow or by Soundar Rajan
Published on 2010-05-11T01:20:43Z Indexed on 2010/05/11 1:24 UTC
Read the original article Hit count: 333

Filed under:
|
|

I have a table with one id (autonumber) field and 50 other fields. The table is normalized, these are 50 material properties etc.

I want to copy a record from this table into the same table - only the autoincrement id will be different. The query I am using now is

INSERT INTO tableName (field1,field2,....field50)
SELECT field1,field2,....field50 from tableName
WHERE autoid=1234;

Note that I have to type in ALL the 50 field names, twice! Is there any way to shorten this query so I don't have to type all of them?

Thanks.

© Stack Overflow or respective owner

Related posts about sql

Related posts about insert