Link to home
Start Free TrialLog in
Avatar of lee88
lee88Flag for United States of America

asked on

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?
Avatar of Om Prakash
Om Prakash
Flag of India image

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.
ASKER CERTIFIED SOLUTION
Avatar of Om Prakash
Om Prakash
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lee88

ASKER

perfect. Thanks!