Add Autonumber field into an existing table

Is there any way(s) to add an autonumber field into an existing table, with existing data, and have this new autonumber field populated, for those existing records?


From the C/Side Reference Guide - Properties:


Use this property to specify whether or not each field value should be automatically given a new number that is greater than the number given to the previous value.

Applies to

Fields of the Integer and BigInteger data type.


A table can only contain one field that has been defined as an auto-increment field.

The numbers that are assigned will not necessarily be consecutive because:

  • If you delete some records from a table, the numbers that are used in these records will not be reused.

  • If several transactions are being performed at the same time, they will each be assigned a different number. However, if one of these transactions is rolled back, the number that it was assigned cannot be reused.

If you add an auto-increment field to an existing table, it will automatically generate consecutive values and insert them into the table.

If you enable the auto-increment property for a field that already contains data, there must be no zero values in the field.

The AutoIncrement property is designed to always assign numbers automatically. If you want to insert a record, you must make sure that the value in the field is blank before you insert the record. This is even more critical when you are using the SQL Server Option. If you want to manually assign a value to a field that has the AutoIncrement property set to Yes, you must be member of the SQL Server db_owner database role for the database in question.

The AutoIncrement property does not work for C/SIDE temporary tables.


I tried to set datatype as RecordID instead.