Select to view content in your preferred language

Data Error due to ESRI OID while publishing SQL Views - tables, Unique Identifier Not appearing

136
0
Sunday
Labels (1)
HamzaSaeed
New Contributor

Hello,

I am publishing SQL Server views as feature layers through ArcGIS Server/Enterprise. Since these views don’t have a primary key, ArcGIS automatically assigns an ESRI_OID when I publish them.

The issue is that when I publish with ESRI_OID then the data table of feature layer shows Data Error, while upon checking it in REST shows entries.

To work around this, I started adding a ROW_NUMBER() in each view, for example:

CAST(ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS INT) AS serial_number,

This works as a pseudo ObjectID, but for some views it works and while adding the view to map opens unique identifier window and for some it is not working and does not open the unique identifier window and directing to ESRI_OID.

My questions are:

Is there a recommended way to assign a persistent ObjectID for SQL views published as feature layers?

Would using something like ROW_NUMBER() OVER (ORDER BY farm_id, …) or a concatenated key (farm_id + row_number) be a reliable solution?

Any guidance or best practices from others who faced this would be very helpful.

Thank you,

0 Kudos
0 Replies