Skip To Content

Add Incrementing ID Field


The Add Incrementing ID Field tool adds a database-maintained ID field to an existing table or feature class in an ALTIBASE, Demang, IBM Db2, Microsoft Azure SQL Database, Microsoft SQL Server, Oracle, or PostgreSQL database. A database-maintained ID field is required on all feature classes or tables you plan to edit through a feature service.


  • This tool can only be used with database tables, not geodatabase tables.

  • You must be the owner of the table to add an ID field to it.

  • If you do not specify a name for the field, ObjectID is used by default. If a field named ObjectID already exists, the tool will not run until you provide a different name.

  • If a database-maintained, incrementing ID field already exists in the table, this tool will not add another one.

  • The following field types are added to the table:

    DBMSData Type


    integer (with database sequence and trigger)


    int32 with identity property


    integer as identity


    number (with database sequence and trigger if created in Oracle 11g; with identity if created in Oracle 12c)



    Azure SQL Database and SQL Server

    integer with identity property


AddIncrementingIDField_management (in_table, {field_name})
ParameterExplanationData Type

The location and name of the table to which you want to add an ID field.

Table View

The name to be used for the ID field. If no input is provided, the name defaults to ObjectID.


Code sample

Add Incrementing ID Field with Existing Connection File

Adds an ID field—FSID—to a table named violations owned by user insp when run from the Python window.

import arcpy
arcpy.AddIncrementingIDField_management("C:/Data/DatabaseConnections/mydb.sde/insp.violations", "FSID")


This tool does not use any geoprocessing environments.

Licensing information

  • ArcGIS Desktop Basic: No
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics