Add Field (Data Management)


Adds a new field to a table or the table of a feature class, feature layer, raster catalog, and/or rasters with attribute tables.



AddField_management (in_table, field_name, field_type, {field_precision}, {field_scale}, {field_length}, {field_alias}, {field_is_nullable}, {field_is_required}, {field_domain})
ParameterExplanationData Type

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, stand-alone tables, rasters with attribute tables, and/or layers.

Mosaic Layer; Raster Catalog Layer; Raster Layer; Table View

The name of the field that will be added to the input table.


The field type of the new field.

  • TEXTAny string of characters.
  • FLOAT Fractional numbers between -3.4E38 and 1.2E38.
  • DOUBLE Fractional numbers between -2.2E308 and 1.8E308.
  • SHORT Whole numbers between -32,768 and 32,767.
  • LONG Whole numbers between -2,147,483,648 and 2,147,483,647.
  • DATEDate and/or time.
  • BLOBLong sequence of binary numbers. You need a custom loader or viewer or a third-party application to load items into a BLOB field or view the contents of a BLOB field.
  • RASTERRaster images. All ArcGIS software-supported raster dataset formats can be stored, but it is highly recommended that only small images be used.
  • GUIDGlobally unique identifier.

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.


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.


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.


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.


Specifies whether the field can contain null values. Null values are different from zero or empty fields and are only supported for fields in a geodatabase.

  • NON_NULLABLEThe field will not allow null values.
  • NULLABLEThe field will allow null values. This is the default.

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

  • NON_REQUIREDThe field is not a required field. This is the default.
  • REQUIREDThe field is a required field. Required fields are permanent and can not be deleted.

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.


Code Sample

AddField example (Python window)

The following Python window script demonstrates how to use the AddField tool in immediate mode.

import arcpy
from arcpy import env
env.workspace = "C:/data/airport.gdb"
arcpy.AddField_management("schools", "ref_ID", "LONG", 9, "", "", "refcode", "NULLABLE", "REQUIRED")
AddField example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the AddField tool.

# Name:
# Description: Add a pair of new fields to a table
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data/airport.gdb"
# Set local variables
inFeatures = "schools"
fieldName1 = "ref_ID"
fieldPrecision = 9
fieldAlias = "refcode"
fieldName2 = "status"
fieldLength = 10
# Execute AddField twice for two new fields
arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "",
                          fieldAlias, "NULLABLE")
arcpy.AddField_management(inFeatures, fieldName2, "TEXT", "", "", fieldLength)


Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes