What I need to do is change data type of a field of a table or feature class. If there are some data, then I need to transfer it, if its possible, if not possible then just set null for that data. I need to do it using python script.


  1. Because of before and after changing the data type, field name is same, I can not add new field with same name using arcpy.AddField_management method.
  2. Because of I need to transfer field values from first field to second one, I need to map both data types.

It will be good for me if I can find any ArcPy procedure similar to artwork21's answer to Renaming field using ArcPy?

  • You might want to vote for this ArcGIS Idea (as if it hasn't gotten enough votes already).
    – blah238
    Feb 22, 2013 at 3:44
  • Does your data happen to be stored in Oracle?
    – blah238
    Feb 22, 2013 at 3:46
  • @blah238: My data is stored in a table/feature class. And the idea is for reordering the fields not changing the data type.
    – Emi
    Feb 22, 2013 at 3:55
  • You misunderstood me. What is your underlying DBMS: Oracle, SQL Server, PostgreSQL, file geodatabase, personal geodatabase, shapefile, etc.?
    – blah238
    Feb 22, 2013 at 3:57
  • 4
    I did not downvote it, but the question does not show much research effort (reads like a "do my homework for me" type question, sorry to say), and could use some minor grammar cleanup.
    – blah238
    Feb 22, 2013 at 4:08

3 Answers 3


There are essentially three options for making field schema changes in ArcGIS.

  1. Dropping the whole feature class/table and replacing it completely
  2. Dropping the field/column and replacing it -- this always puts the new column at the end, so not good if field order is important to you.
  3. Modifying column definitions in the underlying DBMS (dangerous, may cause corruption). This last one I wouldn't even go near unless you are in Oracle, and even then you have to be very careful (see this post).

It sounds like you want to go with option 2. The simplest way I can think of to do that is to add an intermediate/temporary column and calculate it from your original column. Then delete the original column, add a new column with the desired field type, calculate the new column from the intermediate column and finally delete the intermediate column.

  • May be I will go with your 2nd idea. I need to read about it some more. thanks for the idea
    – Emi
    Feb 22, 2013 at 4:03

You could do a simple "Feature Class to Feature Class" conversion. During this you can change field names and types, after that delete the original FC.


Depending on your ArcGIS for Desktop version and where you are storing your data, there is a tool called Alter Field (available at all license levels from 10.2.2; only Advanced at 10.2.1) that may be able to help you because it is designed to:

Rename fields and field aliases, or alter field properties.

However, be aware that if you only change the name, and not the alias too, then when you look at the attribute table, what is displayed as that field's heading will be the alias (i.e. the old field name).

To avoid this, which I find confusing, I always change both the name and the alias .

For example, if I want to change the OLDFIELD to be named NEWFIELD then I use something like:

# AlterField_management (in_table, field, {new_field_name}, {new_field_alias})
AlterField_management (r"C:\temp\test.gdb\testFC", "OLDFIELD", "NEWFIELD", "NEWFIELD")

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.