[GIS] Adding non-nullable field to populated feature class

arcgis-desktoparcgis-proarcpyesri-geodatabasefile-geodatabase

Having a populated feature class in a geodatabase, a non-nullable field should be added (or a currently nullable field changed to non-nullable).

That current field has currently no null values so I thought it's a straight forward job. With SQL I would use something like:

ALTER TABLE FeatureClassX
        ADD Status INTEGER NOT NULL.
    DEFAULT 0

However, I can not change the properties (non-null) with ArcGIS Pro 2.3.x nor with ArcGIS for Desktop 10.x. Also, using the Add Field and Alter Field tools do not allow me to change this property. Most likely due to the lack of being able to set/config a default value in those tools.

The only workaround I can come up at this point is to create a new feature class with same fields and properties and then copy each record one by one from the original feature class to the new one.

It is not difficult to write a script to do the workaround but I would like to avoid it and hope that I just have missed something in ArcGIS Pro 2.3.x and/or ArcGIS for Desktop 10.x. I am looking for a built-in solution for either of the ESRI products (or using Python) since I am currently lucky to have both installed.


Edit 2019-07-17 0821: Alter Field tool added to non-working solutions after I have tried umbe1987's answer

Best Answer

Found a solution: Error: Failed to add one of the specified fields. The field is not nullable

Works with ArcGIS for Desktop and ArcGIS Pro.


Summary

  1. Create a New Feature Class
    • on the last wizard screen, import field properties from existing table
    • then change Allow NULL values to yes and set a default value for the desired field
  2. Use Simple Data Loader to load data (or Append tool in ArcGIS Pro) from the old feature class
Related Question