All layers in ArcGIS—including query layers, layers from geodatabases, and layers from databases—require a unique identifier.
To use a field as a unique identifier in ArcGIS Pro, the field must be not null, must contain unique values, and be one of the following data types:
- Integer (32- and 64-bit positive values only)
- String
- GUID
- Date
- Date only
- Time only
Values in the field must always be unique and not null. It is your responsibility to guarantee that values in this field meet these requirements.
Note:
You will receive an error if ArcGIS encounters a null value, but ArcGIS does not enforce the uniqueness of values in the unique identifier field used in a query layer or database table. If ArcGIS encounters a value that is not unique, no error is returned; however, you may see inconsistent results in selection sets or other queries in ArcGIS.
If you define a query layer on a single enterprise geodatabase table or feature class, use the object ID field as the unique identifier field.
For relational databases and cloud data warehouses, it is standard practice for tables to contain a unique identifier field; therefore, your relational database or cloud data warehouse tables likely already contain a field you can use as a unique identifier. If the feature class or table contains a 32-bit, unique, not null integer, ArcGIS Pro will detect the qualifying field and set it as the unique identifier. This is often an adequate value to use as the unique identifier field, but you can choose another qualifying field or fields from the Unique Identifier Field(s) list instead. To choose a unique identifier, modify the query layer.
When you add a query layer that accesses a table in a document database, ArcGIS Pro automatically uses a system-maintained string field (_id) as the object ID.
To publish the query layer in a feature layer (a feature service) that references a registered data store that is a relational database, cloud data warehouse, or enterprise geodatabase, the ID must be a single, not null, unique, automatically incrementing integer field. For a subset of supported databases, you can run the Add Incrementing ID Field geoprocessing tool to add a supported ID field.
You cannot publish a query layer from a document database at this time.