Error using AddFields_management: Invalid Long type

Discussion created by KarlHuber on Feb 27, 2018
Latest reply on Feb 28, 2018 by KarlHuber



I'm trying to add a couple of fields using the "AddFields_management" from the arcpy that comes with ArcGIS Pro. But when I try to do so, I get an error message that tells me:


arcgisscripting.ExecuteError: ERROR 000378: Invalid Long type.
ERROR 000852: Cannot add field CLASS_ID to F:\Projects\root@Demo2.sde/Demo2.ROOT.StructureLine

What I'm, trying to do is:


add_fields = []
add_fields.append(['CLASS_ID', 'LONG', 'CLASS_ID', None, None)])
add_fields.append(['SUBTYPE_ID', 'SHORT', 'SUBTYPE_ID', None, None)])
arcpy.AddFields_management("F:\Projects\root@Demo2.sde/Demo2.ROOT.StructureLine", add_fields)


I'm lost here. I have no idea why I'm not able to add this field. Interesting: When I'm going to add those fields sequentially using arcpy.AddField_management everything works as expected. Unfortunatelly this is not an option, since I'm going to add a lot of fields to that table (more than 40), which costs a lot of time when I'm doing it field after field (more than a hour per table!)


Do you have any ideas how to use arcpy.AddFields_management properly?


Thanks in advance!