Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Since it is not a good idea to use ObjectIDs as primary keys in relationships, some other column will need to be used. Is it possible to use DBMS sequences to populate primary key columns in versioned featureclasses, or will I need to write arcobjects code to do this?

I've heard Global IDs can be used, but non-GIS DBA's maintaining related tables often frown at this idea.

share|improve this question
    
Moving my answer to a comment since my memory is poor and it might not have worked properly: A number of years ago, I tried using an insert trigger on the adds table. If I recall correctly, that did work. I eventually(and quickly) went to an ArcObjects solution (that called a stored procedure), because it was easier (for me) because I didn't have to write a new trigger when adding/versioning a new featureclass. –  Jay Cummins Jan 27 '11 at 20:51
2  
I think it was an AFTER INSERT trigger (oracle) with a null check, so the new row would get the existing primary key value if it was moved. If it was null, it would populate. Maybe I'm wrong and it wasn't working right and I didn't realize it. What database are using? –  Jay Cummins Jan 27 '11 at 20:52
    
@Jay Thanks for elaborating. My main reason for asking this question is to determine if there are other approaches to this problem besides the arcobjects code I've written to do this. I don't want to tell someone that my solution is the only possible solution without thoroughly investigating. And if so, how difficult it is to maintain it. I only occasionally write stored procedures, and most of that is on sql server. I suspect there is a way to do this at the dbms level (instead of arcobjects) but have never looked at it closely across all dbms's. –  Kirk Kuykendall Jan 27 '11 at 21:47
add comment

1 Answer 1

Yes, it is possible - with a few caveats.

You can do it with triggers - but the implementation will be DBMS-specific (since you will have to implement a different AFTER INSERT trigger using the underlying database (specific) mechanism.

You will not be able to specify a UNIQUE constraint of any kind on that field since the Inserts And Base Tables can potentially have duplicate entries for every row that you modify (That is how updates are modeled in versioned databases). If you make the mistake of doing this on the base table, you will eventually realize this when your compress operations start to fail...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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