Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Facilitates the keying of grid parameters for a spatial index.
Syntax
sys.sp_help_spatial_geography_histogram
[ @tabname = ] N'tabname'
, [ @colname = ] N'colname'
, [ @resolution = ] resolution
[ , [ @sample = ] sample ]
[ ; ]
Arguments
[ @tabname = ] N'tabname'
The qualified or nonqualified name of the table for which the spatial index was specified. @tabname is sysname, with no default.
Quotation marks are required only if a qualified table is specified. If a fully qualified name, including a database name, is provided, the database name must be the name of the current database.
[ @colname = ] N'colname'
The name of the spatial column specified. @colname is sysname, with no default.
[ @resolution = ] resolution
The resolution of the bounding box. Valid values are from 10 to 5000. @resolution is int, with no default.
[ @sample = ] sample
The percentage of the table that is used. Valid values are from 0 to 100. @sample is float, with a default of 100.
Return value
A table value is returned. The following grid describes the column contents of the table.
| Column name | Data type | Description |
|---|---|---|
cellid |
int | Represents the Unique ID of each cell, with a starting count of 1. |
cell |
geography | A rectangular polygon that represents each cell. Cell shape is identical to the cell shape used for the spatial indexing. |
row_count |
bigint | Indicates the number of spatial objects that are touching or containing the cell. |
Permissions
User must be a member of the sysadmin fixed server role.
Remarks
SQL Server Management Studio (SSMS) spatial tab shows a graphical representation of the results. You can query the results against the spatial window to get an approximate number of result items.
Note
Objects in the table might cover more than one cell, so the sum of the cells in the table might be larger than the number of actual objects.
The bounding box for the geography type is the entire globe.
Examples
The following example calls sp_help_spatial_geography_histogram on the Person.Address table in the AdventureWorks2025 database.
EXECUTE sp_help_spatial_geography_histogram
@tabname = N'Person.Address',
@colname = N'SpatialLocation',
@resolution = 64,
@sample = 30;