AnsweredAssumed Answered

Updating field type

Question asked by mimiller on May 3, 2012
Latest reply on May 3, 2012 by mzcoyle
How would one go about updating the field type? I see from the Field documentation,, that you can read and write the field type, but it only updates the field object.  What is the proper method to go about updating the field type so it persists in the GB table? Below is a code snippet am trying to use:
            # set Segment_Code field to string             fields = arcpy.ListFields(outCrash)             for field in fields:                 if == "Segment_code":                     print("field: {0}".format(                     print("type: {0}".format(field.type))                     field.type = "String"                     print("new type: {0}".format(field.type))              # pad 0's to the left of segement codes, need 6 chars for all values             exp = "str(!Segment_Code!).zfill(6)"             arcpy.CalculateField_management(outCrash, "Segment_Code", exp, "PYTHON")