What is an object ID?
An object ID is a unique, not null integer column used to uniquely identify rows in tables in a geodatabase. Tables that are created through ArcGIS, or created outside ArcGIS then registered with ArcSDE and the geodatabase, must contain an object ID column that is maintained by the geodatabase. The object ID is used by ArcGIS to do such things as scroll and display selection sets and perform identify operations on features.
Since most ArcGIS Desktop functionality requires the object ID to be unique, caution should be used when working directly with the database so that Object IDs are not duplicated. For example, when creating views with a one-to-many relationship, there is the possibility that ObjectIDs will be duplicated. This causes inconsistent behavior in ArcGIS Desktop functionality.
There are three ways a qualifying object ID is added to a table:
- A geodatabase-maintained object ID column is automatically added to any table created using ArcGIS.
- You specify a column to be used as the object ID field when you register a table with ArcSDE using the sdetable or sdelayer command. You can designate an existing, qualifying column as the object ID, or specify a name for a new object ID column. If you specify a new column name, ArcSDE adds an integer, not null, unique column with that name to the table. At the same time that you specify the column to use as an object ID, you also specify whether that column is to be maintained by ArcSDE or by you (user maintained). Note:
The geodatabase requires a system-maintained object ID. Therefore, if you are going to also register the table with the geodatabase, you should register the object ID as maintained by ArcSDE. If instead you define a user-maintained object ID, the geodatabase adds a new object ID column when you subsequently register the table with the geodatabase. This new object ID column supersedes the column you specified when you registered the table with ArcSDE. It also changes the data type of your user-defined object ID from an object ID to a long integer.
- If you register a table with the geodatabase that does not have a qualifying column, the geodatabase adds another column to the table that meets the requirements of an object ID. If your table already contains a column that is named object ID, the geodatabase adds a column named OBJECTID_.