Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

while inserting what to do with autonumber 1

Status
Not open for further replies.

557

Programmer
Oct 25, 2004
64
0
0
US
i have a table with one field set as autonumber. if i want to insert records into this table from another table using sql,

insert into table1 select * from table2

will the autonumber field be updated automatically? how exactly should i give the sql to insert all the fields in table2 into table1 with the autonumber of table1 automatically incremented
 
Correct, autonumber will be triggered by the OnInsert event. Do not assign a number to the autonumber field -- let Access take care of updating this field for you.
 
is there any maximum number to which the autonumber will be set? each time, i'm clearing the table and adding new set of records. at that time, the autoincrement will not get reset. so, will the autoincrement number fail at any point of time?
 
will the autoincrement number fail at any point of time
At circa 2147483647

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Autonumber is a long interger.

After you have finished "playing", Compact and Repair the database to reset the number to the lowest possible number. Deleting test (all) records can reset the number to one. (Back up first)

Note:
Do not associate the autonumber to have any meaning. It's sole purpose is to uniquely identify each record.

Ensure that you create formal relationships between related tables, and enforce referential integrity so you do not accidently deleted records that create "orphans".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top