ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Modify Method / Modify(TableDescription,String,FieldDescription) Method
Indicates the ArcGIS.Core.Data.Table where the field will be modified.
Indicates the ArcGIS.Core.Data.Field to be modified.
Indicates the field that will replace the old field.
Example

In This Topic
    Modify(TableDescription,String,FieldDescription) Method
    In This Topic
    Enqueue the modify operation on the object referred to by the TableDescription.
    Syntax

    Parameters

    tableDescription
    Indicates the ArcGIS.Core.Data.Table where the field will be modified.
    fieldName
    Indicates the ArcGIS.Core.Data.Field to be modified.
    fieldDescription
    Indicates the field that will replace the old field.
    Exceptions
    ExceptionDescription
    The subtypes are invalid or fieldName does not exist as a field in tableDescription.
    tableDescription, fieldName, and/or fieldDescription is null.
    Remarks

    Memory geodatabases do not support modifying field type, name, or nullable properties.

    Mobile geodatabases do not support modifying field type or length.

    The following fields cannot have their field name, type, or length changed.

    • Object ID
    • Global ID
    • Shape, Shape area, or Shape length​
    • Subtype field​
    • Relationship primary and foreign key fields​
    • Editor tracking fields​
    • Fields used in attribute rule​
    • Non-editable fields​
    • Required fields

    If the table is empty, the length can be increased or decreased​ in text fields.

    If the table is not empty, the length can only be increased in text fields.

    If the table is empty, the field type and nullable properties can be changed.

    Precision and scale cannot be modified in enterprise geodatabases​. These properties are not applicable for file, mobile, and memory geodatabases and default to 0​.

    Example
    Modifying an existing field
    private void ModifyExistingField(SchemaBuilder schemaBuilder, TableDefinition tableDefinition, string fieldNameToBeModified = "PropertyAddress")
    {
      Field field = tableDefinition.GetFields().FirstOrDefault(f => f.Name.Contains(fieldNameToBeModified));
    
      // Update field's alias name and length
      FieldDescription fieldDescription = new FieldDescription(field)
      {
        AliasName = "Physical Property Address",
        Length = 50
      };
    
      // Update the default value
      fieldDescription.SetDefaultValue("123 Main St");
    
      // Enqueue modify operation
      schemaBuilder.Modify(new TableDescription(tableDefinition), field.Name, fieldDescription);
    
      // Execute DDL
      schemaBuilder.Build();
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also