Increment field by 1 on insert Query

  • Thread starter Thread starter Dale
  • Start date Start date
D

Dale

I want to be able to insert a whole bunch of records from one table into
another table using a query. I need to be able to set/increase the value of a
field that is a number with each row it inserts. Most people will say to have
it as an autonumber field but that is not an option here. Any ideas on how to
do this?

Sample data
Joe1, Address1, City2, Train1
Joe2, Address2, City3, Train4
Joe3, Address3, City1, Train2

Inserted into table sample
1, Joe1, Address1, City2, Train1
2, Joe2, Address2, City3, Train4
3, Joe3, Address3, City1, Train2
 
This can be done in a query using a ranking column to generate an
incrementing number. This depends on you describing the sort order of the
records being inserted.
 
Back
Top