ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

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
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Add Incrementing ID Field

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

Summary

The Add Incrementing ID Field tool adds a database-maintained ID field to an existing table or feature class in an ALTIBASE, IBM DB2, 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

  • 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

    ALTIBASE

    integer (with database sequence and trigger)

    DB2

    integer as identity

    Oracle

    number (with database sequence and trigger)

    PostgreSQL

    serial

    SQL Server

    integer with identity property

Syntax

AddIncrementingIDField_management (in_table, {field_name})
ParameterExplanationData Type
in_table

The location and name of the table 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

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 an ArcGIS for Desktop client computer on which a pre-created database connection file (.sde) is stored in the default connection file location.

AddIncrementingIDField_management("Database Connections//insp.violations", "FSID")

Environments

This tool does not use any geoprocessing environments

Licensing information

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

Related topics

  • An overview of the Fields toolset

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

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

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal