-2

What geoprocessing tool can I use to copy a table from an ArcSDE Geodatabase to a Personal Geodatabase, keeping the feature ID (objectID)?

0

3 Answers 3

5

There is no Geoprocessing tool to do this and I think that there is no case for one to be developed because, as commented by @blah238:

You should not rely on the consistency of ObjectIDs for any purpose. Instead, you should have a persistent and unique ID in a separate column. In a pinch you could just calculate a new field based on the current ObjectID and use that going forward.

4

Just as with most GIS professionals, I do NOT condone the use of ObjectID as a unique ID. Unfortunately, I have been to numerous facilities where they STILL do this. In turn I have had to come up with a work around myself.

To answer your direct question, if you COPY the feature class whether it be to an "_1" and then renamed or to another geodatabase, or in SDE, the system will preserve the existing ObjectID field but it will also create a NEW ObjectID_1 field that will become the unique identifier. This does make for slightly messy table structure, but it will give you the opportunity to create a new unique ID and/or reference the old ObjectIDs if required.

If you do this through an Import or a Data Load, the old ObjectID will NOT be brought over. Similar to blah238's suggestion, I set up a trigger on the a tables in SQL to automatically calculate the UniqueID equal to the ObjectID when a feature is created. This way, if my data becomes corrupt, needs to be moved, etc, I still have that UniqueID to fall back on.

0
0

I found this answer and am copying here just in case. This is particularly helpful if you want to transfer attachment relation class' feature class(es) because they operate over OBJECTIDs.

Basically it suggests using FeatureSet for this purpose. Unlike Copy_management which expects a full dataset as input and creates an exact copy, this can process map layers and honours the selection.

fs = arcpy.FeatureSet()
fs.load("a layer from TOC or any feature class")
fs.save(output_location)

If you want to copy a table, the first line can be modified as:

fs = arcpy.RecordSet()
2
  • I tried to work with this but it is returning an empty feature class instead of copying the features. Sep 3, 2021 at 8:47
  • Does fs.JSON return anything? Did you try to load another sde dataset and maybe to use an empty personal geodatabase (mdb) to test? I just tested the procedure and it works fine.
    – fatih_dur
    Sep 3, 2021 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.