ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Add Incrementing ID Field

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Adds a database-maintained ID field to an existing table or feature class in a Dameng, 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.

Usage

  • You cannot run this tool on tables or feature classes that are registered with the geodatabase.

  • You must be the owner of the table or feature class 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, this tool will not add another one.

  • The following field types are added:

    DBMSData Type

    Dameng

    int32 with identity property

    Db2

    integer as identity

    Oracle

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

    PostgreSQL

    serial

    Azure SQL Database and SQL Server

    integer with identity property

Syntax

AddIncrementingIDField(in_table, {field_name})
ParameterExplanationData Type
in_table

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

Table View
field_name
(Optional)

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

String

Derived Output

NameExplanationData Type
out_table

The input table that is updated to include an incrementing ID field.

Table

Code sample

AddIncrementingIDField example (Python window)

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")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics

  • An overview of the Fields toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2019 Esri. | Privacy | Legal