how to add AutoNumber field or Indexed field to an existing table

http://www.codeproject.com/KB/database/IndexedField.aspx
To add a new field CustID to the existing table Customers:

Collapse
strSql = "ALTER TABLE Customers ADD COLUMN CustID Integer" : type of field is Integer.
To add AutoNumber field CustID to existing table Customers, make sure that the table does not have another field as AutoNumber:

Collapse
strSql = "ALTER TABLE Customers ADD COLUMN CustID COUNTER"
To add AutoNumber field as Primary Key CustID to an existing table Customers make sure that the table does not have another field as AutoNumber:

Collapse
strSql = "ALTER TABLE Customers ADD COLUMN CustID COUNTER PRIMARY KEY"

Comments

Popular Posts