The ObjectID field is maintained by ArcGIS and guarantees a unique ID for each row in a table. When you look at a table or a layer's attribute table, you will usually see the ObjectID field listed under the aliases of OID or ObjectID. Key functions, such as scrolling and displaying selection sets, depend on the presence of this field.
Most data sources supported by ArcCatalog and ArcMap provide an ObjectID field with their tabular data. In these cases, the ObjectID field is accessed directly and used by the Table window in ArcMap and table preview in ArcCatalog. The following data sources, however, do not contain an ObjectID field with their tabular data:
- OLE DB data
- Delimited text file data
- Microsoft Excel data
- Nonspatial data from SDE 3 (Note: Spatial data has an ObjectID field.)
- Unregistered nonspatial data from ArcSDE (Note: Unregistered spatial data has an ObjectID field.)
- Unregistered data from a personal geodatabase
If you are unsure what type of table you're working with and whether it has an ObjectID field, you can quickly find out. In ArcMap, on the top of the table of contents window click the List By Source button , right-click the table in the table of contents, then click Properties. Click the Source tab on the Table Properties dialog box and look for either a Yes or No for the Has Object-ID Field entry. In ArcMap or ArcCatalog, you can open the table's Properties dialog box and click the Fields tab. If there is no field listed with an ObjectID data type, the data does not have an ObjectID field.
If your table lacks an ObjectID field, you won't be able to perform the following operations:
- Select the features in the layer on the map. Although you can select records in the Table window, including selecting using an expression on Select By Attributes, this selection set is not reflected on the map.
- Apply a definition query to display only a subset of records or features.
- Create relates. You can relate to a table without an ObjectID field from a table with an ObjectID field, however. In this case, the relate can be used by the Identify tool to list related records. You can't push selections via the relate.
- Start an edit session and edit the attributes. However, you can edit the table the layer is based on directly on disk, such as in a text editor if the file is a .txt file. Your changes will then be reflected on the map the next time you refresh the map.
There are several ways of obtaining an ObjectID field for your data:
- If you are working with a table of x,y coordinates and displaying them in ArcMap, you can export the x,y layer to a new feature class. You can also convert a table of coordinates into a new point feature class in ArcCatalog. Both of these procedures create a fully functional feature class with an ObjectID.
- You can use the Make Query Table tool, which allows you to make the table using an OLE DB connection and to specify a column to use for the ObjectID or dynamically add the ObjectID.
- With some data sources, you can register data with ArcGIS, which adds an ObjectID field.