When you create a table or add a column to a table in a database, you define a specific data type for the column. Data types determine the following:
- What values you can store in the column
- What operations you can use on the data in that column
- How the data in that column is stored in the database
ArcGIS works with specific data types. When you access a database table through a Database Connection or a query layer, ArcGIS filters out any unsupported data types. ArcGIS will not display unsupported data types and you cannot edit them through ArcGIS. Similarly, when you use ArcGIS to copy and paste tables containing unsupported data types from one database to another, ArcGIS only pastes columns that use a supported data type.
The first column in the following table lists the ArcGIS data types. The second column lists the SQL Server data type that ArcGIS creates. The third column shows what other SQL Server data types (if any) map to the ArcGIS data type when you view a table that you created outside ArcGIS. The last column provides additional information when needed.
ArcGIS data types | SQL Server data types created | Other SQL Server data types that can be viewed | Notes |
---|---|---|---|
BLOB |
VARBINARY(MAX) | BINARY, IMAGE, TIMESTAMP, VARBINARY(n) | |
DATE |
DATETIME2(7) | DATETIME2(n), DATETIME, SMALLDATETIME | |
DOUBLE |
NUMERIC(p,s) | DECIMAL, FLOAT, MONEY, SMALLMONEY | The precision and scale specified in ArcGIS can affect the resultant data type created in the database. See ArcGIS field data types for more information. |
FLOAT |
NUMERIC(p,s) | REAL | The precision and scale specified in ArcGIS can affect the resultant data type created in the database. See ArcGIS field data types for more information. |
GEOMETRY |
| In an enterprise geodatabase, the SQL Server data type that is created depends on the GEOMETRY_STORAGE parameter of the configuration keyword used when the feature class was created. SDEBINARY = INT; GEOMETRY = a GEOMETRY column; GEOGRAPHY = a GEOGRAPHY column. In a database, you specify whether to use GEOMETRY or GEOGRAPHY when a feature class is created. In desktop and workgroup geodatabases, the GEOMETRY type is always used. ArcGIS does not support the following GEOMETRY subtypes:
| |
GLOBAL ID | UNIQUEIDENTIFIER | Only supported in geodatabases. | |
GUID |
UNIQUEIDENTIFIER | ||
LONG INTEGER |
INT | ||
RASTER |
BLOB, INT, ST_RASTER | Raster data types are only supported in geodatabases. In desktop and workgroup geodatabases, rasters are always created as BLOB data types. In enterprise geodatabases, the SQL Server data type that is created depends on the configuration keyword used when you create the raster dataset or mosaic dataset. If the keyword's RASTER_STORAGE parameter is set to RASTERBLOB, a BLOB column is created; if set to BINARY, an INT column is created; if set to ST_RASTER, an ST_Raster column is created. You must separately configure ST_Raster in the enterprise geodatabase if you want to use it. See Install ST_Raster in SQL Server for instructions. | |
OBJECT ID |
INT(4) when created in an enterprise geodatabase INTEGER with IDENTITY property when created in a database | The ArcGIS type ObjectID is the registered row ID column for the table (or feature class.) Only one may exist per table. | |
SHORT INTEGER |
SMALLINT | BIT, TINYINT | |
TEXT |
VARCHAR, NVARCHAR, VARCHAR(MAX), NVARCHAR(MAX) | CHAR, NCHAR |
Text data types
If you create a VARCHAR or VARCHAR(MAX) field in a SQL Server database, it will be mapped to the ArcGIS TEXT data type when viewed in ArcGIS. If you create a TEXT field in a SQL Server database from ArcGIS, either NVARCHAR or NVARCHAR(MAX) is used.
In an enterprise geodatabase, if the UNICODE_STRING configuration parameter is set to FALSE and the text field is 7,999 characters or fewer, VARCHAR is used.
If the UNICODE_STRING configuration parameter is set to FALSE and the text field is 8,000 characters or more, VARCHAR(MAX) is used.
If the UNICODE_STRING configuration parameter is set to TRUE and the text field is 3,999 characters, NVARCHAR is used.
If the UNICODE_STRING configuration parameter is set to TRUE and the text field is 4,000 characters or more, NVARCHAR(MAX) is used.
Geometry data types
As indicated in the table, ArcGIS creates and can work with three geometry data types in SQL Server: compressed binary, SQL Server Geometry, and SQL Server Geography.
Compressed binary
The Esri compressed binary storage type uses a binary storage mechanism for storing feature geometry. Compressed binary geometry storage can only be used in geodatabases. A compressed binary feature class is made up of three tables: the business table, feature table, and spatial index table.
After verifying the geometry, the client application compresses and sends it to the geodatabase, where it is stored in compressed binary format in a feature table, or F table. Compressing the geometry on the client unloads the task from the database server and reduces the transmission time to send the geometry. It also offers efficient storage and retrieval of spatial data by reducing the space required to store data by as much as 40 percent.
The business table contains attributes and a spatial column. The spatial column is a key to the feature and spatial index tables.
The relationship between the business table and feature table is managed through the spatial column and the feature ID (FID) column. This key, which is maintained by ArcGIS, is unique.
SQL Server Geometry
The following is a summary of the Microsoft Geometry type. For more information on the Geometry type and how to use it, see Microsoft SQL Server documentation.
- The Microsoft Geometry type supports any X/Y coordinate system.
- Planar (flat-Earth, Euclidean) calculations and straight-line interpolation between vertices are used for rendering and spatial comparisons.
- Conforms to the Open Geospatial Consortium (OGC) Simple Features for SQL Specification version 1.1.9, and compliant with SQL MM, an ISO standard.
SQL Server Geography
The following is a summary of the Microsoft Geography type. For more information on the Geography type and how to use it, see Microsoft SQL Server documentation.
- The Geography type supports many standard geographic coordinate systems, such as GPS latitude and longitude.
Microsoft requires that you use SRIDs and the geographic coordinate systems defined in the SQL Server data dictionary.
- An ellipsoid (round Earth) model and Great Elliptic interpolation of line segments between vertices are used for calculations and spatial comparisons.
- The Geography type uses a global (spheroidal) layer extent.
Coordinates of the data cannot exceed global extent.
Raster data types
The default raster type used in geodatabases in SQL Server is a BLOB type (rasterblob). If you need to access rasters stored in your geodatabase using SQL, configure your enterprise geodatabase in SQL Server to use the ST_Raster type.
For in-depth information on how the ST_Raster object type is defined, see The ST_Raster data type.