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.
Problems:
- 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. - 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?
Best Answer
There are essentially three options for making field schema changes in ArcGIS.
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.