操作方法

操作方法:更改现有字段的数据类型

Last Published: April 23, 2024

摘要

In some cases, attributes are stored in fields of a specific data type with limited capabilities. For example, math functions cannot be performed on Text fields because integers do not store decimals. A field of type Short cannot contain decimal numbers or whole numbers larger/smaller than 32,768/-32,768. For more information, read ArcMap Help: ArcGIS field data types.

While it is not possible to change the data type of an existing field, the same results can be achieved by transferring attributes from one field/data type to another desired field/data type.

过程

To do this in ArcMap, refer to the workflow provided below.

  1. Right-click the feature class of the field/table to be modified, and select Open Attribute Table.
  2. Create a new field. To do this, in the attribute table, click the Table Options button on the top-left, and select Add Field. Enter a name for the new field, and set the preferred data type and properties. Click OK.
  3. Right-click the new field and select Field Calculator. Click Yes if a prompt to do a calculation outside of an edit session appears.
  4. Transfer the data to the new field. Under Fields in the Field Calculator dialog box, double-click the name of the field containing the attributes to be transferred to the new field. Click OK.
    Below is an example expression used to calculate the 'Zion_Code' field with values from the 'ZION_NO' field.
Zion_Code = [ZION_NO]
The image below is an example of the calculate expression in the Field Calculator dialog box.
An image of the Field Calculator dialog box.
Note:
When transferring attributes from a text field to a field with a numeric data type, the attributes must only have numbers, and no other characters except decimal points.
  1. The new field contains the data from the previous field, but stored as a different data type. Delete the old field, if necessary, once confirmed that the data transfer is successful.

If encountering further issues, refer to the web help documentation in the related links section below.

文章 ID:000009835

从 ArcGIS 专家处获得帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项