Add Field (Data Management)

Adds a field to the table of a feature class, feature layer and/or raster catalog.

Learn more about how Add Field works

Usage tips


AddField_management (in_table, field_name, field_type, field_precision, field_scale, field_length, field_alias, field_is_nullable, field_is_required, field_domain)
Parameter Explanation Datatype
Input Table (Required)

The input table to which the specified field will be added. The field will be added to the existing input table and will not create a new output table.

Fields can be added to feature classes of ArcSDE, file or personal geodatabases, coverages, shapefiles, raster catalogs, standalone tables, and/or layers.

Table View | Raster Layer
Field Name (Required)

The name of the field that will be added to the Input Table.

Field Type (Required)

The field type used in the creation of the new field.

  • TEXT—Names or other textual qualities.
  • FLOAT—Numeric values with fractional values within a specific range.
  • DOUBLE—Numeric values with fractional values within a specific range.
  • SHORT—Numeric values without fractional values within a specific range; coded values.
  • LONG—Numeric values without fractional values within a specific range.
  • DATE—Date and/or Time.
  • BLOB—Images or other multimedia.
  • RASTER—Raster images.

Field Precision (Optional)

Describes the number of digits that can be stored in the field. All digits are counted no matter what side of the decimal they are on.

If the input table is a personal or file geodatabase the field precision value will be ignored.

Field Scale (Optional)

Sets the number of decimal places stored in a field. This parameter is only used in Float and Double data field types.

If the input table is a personal or file geodatabase the field scale value will be ignored.

Field Length (Optional)

The length of the field being added. This sets the maximum number of allowable characters for each record of the field. This option is only applicable on fields of type text or blob.

Field Alias (Optional)

The alternate name given to the field name. This name is used to give more descriptive names to cryptic field names. The field alias parameter only applies to geodatabases and coverages.

Field Is Nullable (Optional)

A geographic feature where there is no associated attribute information. These are different from zero or empty fields and are only supported for fields in a geodatabase.

  • NON_NULLABLE—The field will not allow null values.

  • NULLABLE—The field will allow null values. This is the default.

Field Is Required (Optional)

Specifies whether the field being created is a required field for the table; Only supported for fields in a geodatabase.

  • NON_REQUIRED—The field is not a required field. This is the default.
  • REQUIRED—The field is a required field. This means new records must contain a value for the field. Required fields are permanent and can not be deleted.

Field Domain (Optional)

Used to constrain the values allowed in any particular attribute for a table, feature class, or subtype in a geodatabase. You must specify the name of an existing domain for it to be applied to the field.

Data types for geoprocessing tool parameters

Script Example

import arcgisscripting
gp = arcgisscripting.create()

# Set a default workspace
gp.workspace = "c:\\test_data"

# Set a toolbox
gp.toolbox = "management"

    # Add a field to this shapefile, of type LONG
    gp.addfield ("harvestable.shp", "year", "long", "9")

    # Adds a geodatabase stand-alone feature class of type LONG
    gp.addfield ("redlands.mdb\streets", "ref_ID", "long", "9", "#", "#", "refcode", "NULLABLE", "REQUIRED", "#")

    # If an error occurs when running Addfield, print out the error message.
    print gp.GetMessages(2)

See Also

  • Add Item (Coverage)
  • Calculate Field (Data Management)
  • Delete Field (Data Management)