Select to view content in your preferred language

Unable to change primary key in feature class.

3293
1
09-14-2012 10:39 AM
ChandraKrish
New Contributor
My setup: ArcSDE 9.3 ArcCatalog 10.

I am trying to change the primary key in a feature class from one field to another. I am using the following command which returns success.

sdetable -o alter_reg -t <feature class table> -c <field to use for primary key> -C USER -u <username> -p <password> -i 5151


Now, when i try to delete the field that was previously a primary key throws the error "one or more fields cannot be deleted". I am following the below steps to delete a field from feature class in arccatalog.
- Open arccatalog. Locate feature class from connection.
- Right click properties.
- Go to Fields tab.
- Highlight the field and press delete key.

I am suspecting one of the following reasons based on my limited knowledge.
- Switching primary key did not happen despite the success message running the above command.
- I need to enforce the primary key change with a followup command, which i am not aware.

Any thoughts would be helpful.

Thanks
Chan
0 Kudos
1 Reply
VinceAngelo
Esri Esteemed Contributor
'sdetable -o alter_reg -C' doesn't specify a primary key, it specifies the registered rowid
column (which need not be a primary key, only NOT NULL, of SE_INT32_TYPE, and unique
[repeatedly so, not from a dynamic row number]).

'sdetable -o describe' will report what type it thinks each column is, and will show the
current registered rowid.

If I'm making non-trivial changes to tables, I usually fall back to my data creation scripts,
modify them, and roll the table creation process forward from there.  I don't think I've
ever deleted a column from a registered table.  I also avoid changing table structure
after a table has been registered with the geodatabase.

- V
0 Kudos