Alter Field character limit incorrect

5892
7
Jump to solution
07-01-2015 06:43 AM
YogiPatel
New Contributor II

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.

0 Kudos
1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

Hi Yogi,

I looked into this issue and I have been able to replicate it. This issue appears to be a bug because I'm able to create fields in a file geodatabase with 64 characters, as per the documentation, but the Alter Field management tool appears to be restricted to 31 characters.

Defining fields in tables

http://desktop.arcgis.com/en/desktop/latest/manage-data/geodatabases/design-defining-fields-in-table...

fields.png

If you have an active support account could you send me a private message with your account information so that can attach your information to the bug I'll log for this issue?

Workaround

At the moment the only workaround I can see for this issue is to use the Add Field tool. Unlike the Alter Field tool, this tool will modify the order of your fields. If field order is important to you I would suggest either using python to create a new template feature class with your updated field and loading your data into this new dataset prior to overwrite the original class or create a fieldmappings object against your data, updating the information for the needed field, and then using the Feature Class to Feature Class to create a new clone of your data prior to overwriting it.

View solution in original post

7 Replies
DanPatterson_Retired
MVP Emeritus

From the help Alter Field—Help | ArcGIS for Desktop

The name of the field to alter. If the field is a required field (isRequired=true), only the field alias may be altered

The new length of the field. This sets the maximum number of allowable characters for each record of the field. This option is only applicable on fields of type TEXT or BLOB. Only applicable if table is empty.

There are two things, to check, whether the field is required and/or the size of the field and whether the table is empty or not.

This suggests that the table may need to be empty...which doesn't make much sense, so I would have a look at

  1. the script examples that follow,
  2. make sure your table is closed when you do this and
  3. check the requirements as listed in the help file.

As a note for associated reference, this error message applies to ArcGIS Pro 001600: Failed to alter field name.—Help | ArcGIS for Professionals

0 Kudos
YogiPatel
New Contributor II

From the resource guide  ArcGIS Help (10.2, 10.2.1, and 10.2.2)

Field names are limited to 64 characters for both file and personal geodatabases, 31 characters in SQL Server and SQLExpress, 30 characters in Oracle and DB2; dBASE is limited to 10 characters.

And I'm getting this error:

ERROR 000313 ArcGIS Help (10.2, 10.2.1, and 10.2.2)

The length of Field Name must not be larger than 31

So what I'm wondering is if I'm using a file geodatabase table, why am I restricted to the SQL server limit of 31 characters instead of 64 characters?

0 Kudos
DanPatterson_Retired
MVP Emeritus

That appears to be a bug, however, do you really need this capability on a regular basis?  What circumstances would require regular one to have to change field names?  I can see field width, but not the name.  Perhaps you could append extra underscores ________ to the end of a filename to provide place markers for future size changes.  Have you tried to decrease the fieldname width rather than increase it?​

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Yogi,

I think we can't do much about that limitation of 31 characters in Alter Field Tool.

As a workaround, you can always create a new field with desired fieldname (upto 64 chars) and transfer the values of older field using FieldCalculator.



Think Location
0 Kudos
YogiPatel
New Contributor II

Jayanta,

So is the tool itself broken? I understand the work around, and I believe that was the only solution prior to the Alter Field Tool being implemented. I only hesitate to revert back to changing field names that way is that it seems much more inefficient when trying to change multiple fields in a table.

But if that's the only solution...

FreddieGibson
Occasional Contributor III

Hi Yogi,

I looked into this issue and I have been able to replicate it. This issue appears to be a bug because I'm able to create fields in a file geodatabase with 64 characters, as per the documentation, but the Alter Field management tool appears to be restricted to 31 characters.

Defining fields in tables

http://desktop.arcgis.com/en/desktop/latest/manage-data/geodatabases/design-defining-fields-in-table...

fields.png

If you have an active support account could you send me a private message with your account information so that can attach your information to the bug I'll log for this issue?

Workaround

At the moment the only workaround I can see for this issue is to use the Add Field tool. Unlike the Alter Field tool, this tool will modify the order of your fields. If field order is important to you I would suggest either using python to create a new template feature class with your updated field and loading your data into this new dataset prior to overwrite the original class or create a fieldmappings object against your data, updating the information for the needed field, and then using the Feature Class to Feature Class to create a new clone of your data prior to overwriting it.

YogiPatel
New Contributor II

Hi Freddie,

I actually went ahead and submitted this as a bug yesterday and got confirmation that it's been logged today.

Thanks for your help!

0 Kudos