If I have this file geodatabase table with the format of:

ColA | ColB| ColC | ColD | ColE | ColF etc...

I want to declare a combination of columns will be the primary key (ColA | ColB| ColC). When I say primary key, I want to say that the combination of ColA | ColB| ColC defines a unique row within the table.

I was thinking of using Add Attribute Index tool in ArcGIS Desktop on these three columns, but I'm not sure if that is the right approach.

  • Concatenate them into new text field. – FelixIP Aug 12 '19 at 20:34
  • 1
    Building a compound index isn't the same as a primary key, but I don't think file geodatabase even supports the concept of a primary key, at least in the way the real databases do. – Vince Aug 12 '19 at 21:52

You can use your field calculator for this. Add a new text field to your table that will be your key field. Right-click on its field name in the attribute table and choose Field Calculator... enter image description here

Use [ColA] & [ColB] & [ColC] for your field calculation.

enter image description here

| improve this answer | |
  • How can you be sure that the values in the new field are unique and prevent inserts and updates with already used values? – user30184 Aug 13 '19 at 6:28
  • I believe that may be coming, sort of, in a future release. But maybe I am misremembering from the UC. As of now, If you really need to do this, you can use query layers to get counts within multiple field sorts, or use concatenated keys and just summarize, to find duplicates after the fact. Most big applications would do this outside ArcGIS in other database managers. – danak Aug 15 '19 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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