2

I'm having trouble with the Alter Field Data Management tool -- it will not allow me to create a field name longer than 31 characters. The table I'm using is a File Geodatabase table, where the character limit on field names is 64 characters.

When importing and creating tables, I'm allowed to have field names (and aliases) that are longer than 31 characters, but when I try to alter the field name, this restriction is placed.

Can't seem to find information on this anywhere.

3
  • Just tried this and was able to replicate the issue. I followed the error code link to the help file and as you say it does state a 64 character limit. Looks like you have found a bug, you should report it to ESRI.
    – Hornbydd
    Commented Jul 1, 2015 at 15:27
  • 1
    Hornbydd - Have posted this question to GeoNet and reported as a bug. Will update this post if I get any additional info.
    – ypatel
    Commented Jul 1, 2015 at 15:29
  • Same thing on 10.3.1, just tested. Commented Jul 1, 2015 at 17:19

1 Answer 1

0

So this bug has been reported to ESRI and hopefully they'll fix it, but in the meantime, here's the work around:

First create a new field:

import arcpy
from arcpy import env
env.workspace = "C:/data/test.gdb"

#Name of Feature Class
fc = "Table1"

#New Field Name
newFieldName = "New_Field_Name" 

#Add new field to table
arcpy.AddField_management(fc, newFieldName, "TEXT")

Then copy the values of the original field name into this new field:

arcpy.CalculateField_management(fc, newFieldName, "!Old_Field_Name!", "PYTHON_9.3")

Finally, delete the field with the old field name:

arcpy.DeleteField_management(fc, "Old_Field_Name")
1
  • Even though you can make field names 64 characters, it is still best practice to not exceed 30 (which allows you to move your data to any database).
    – Vince
    Commented Jul 1, 2015 at 19:14

Your Answer

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

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