ADO table: how to INSERT dupliate of a record with autonumber primary key?

I need to understand how to do this with an ADO table named tblLineItems :
After SELECTing a single record (its autonumber field named ID is equal to x),
How do I INSERT a single dupliate of that record into the same table, but let the table's autonumber field (which is its primary key) generate a new autonumber value for the new record?
lee88Asked:
Who is Participating?
 
Om PrakashCommented:
Insert into tblLineItems (field1, field2)
SELECT field1, field2 FROM tblLineItems WHERE id = 2

-- ID column is not selected in selected or insert columns (Considering ID is identity column)
0
 
Om PrakashCommented:
If you have a table with autoumber field and want to insert data from same table then you can do following:

Insert into Table1 (field1, field2)
SELECT field1, field2 FROM Table1

Do not include autonumber column. it will be populated automatically.
0
 
lee88Author Commented:
perfect. Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.