Is there any way to preserve OBJECTID while exporting feature class to another EGDB using Feature class to feature class ?
Solved! Go to Solution.
I have found that using the copy function in ArcGIS Desktop keeps the OBJECTID values of the source feature class. Feature Class to Feature Class does not reliably, in my experience. I am not sure if these statements are true in ArcGIS Pro. I still wouldn't count on OBJECTID column being preserved when moving a feature class from one source to another and would recommend abandoning any workflows that rely on the OBJECTID values.
Hi @TonyContreras_Frisco_TX , Yes the copy function works in both Desktop and ArcGIS Pro and It can retain the OBJECTID.
Hence I wrote the below python to achieve it.
I have found that using the copy function in ArcGIS Desktop keeps the OBJECTID values of the source feature class. Feature Class to Feature Class does not reliably, in my experience. I am not sure if these statements are true in ArcGIS Pro. I still wouldn't count on OBJECTID column being preserved when moving a feature class from one source to another and would recommend abandoning any workflows that rely on the OBJECTID values.
Hi @TonyContreras_Frisco_TX , Yes the copy function works in both Desktop and ArcGIS Pro and It can retain the OBJECTID.
Hence I wrote the below python to achieve it.
As OBJECTID is a system created primary key, none of the tools are going to keep it other than by luck. If you want to retain the value, create a new column in the feature class with same data type as OBJECTID, maybe with a name like old_objectid. The use the field calculator to set the old_objectid = OBJECTID. Then export.
Hi @DavidAnderson_1701 ,
It can preserve the OBJECTID if we use the copy function like @TonyContreras_Frisco_TX mentioned above.
And no other ArcPy function can preserve the object if there's any non sequential numbers in it (Like by luck)