Assert verifies that index is the SPATIAL index. Fail when index has not been found for a specified table or when index is not a spatial index.

Note:
- Supported in SQL Server framework versions.

Arguments

  • v_IndexName – index name, SYSNAME
  • v_ObjectName – table or view name, SYSNAME
  • v_UserMessage – message to report when assertion fails, NVARCHAR(MAX)

Examples

 
SQL Server 

Below is assert that verifies filtered index created in the following statement:

CREATE TABLE SPATIAL_INDEXTABLE(
   ID INT,
   GeometryCol GEOMETRY,
   GeographyObject GEOGRAPHY,
   CONSTRAINT PK_SPATIAL_INDEXTABLE_on_ID PRIMARY KEY CLUSTERED (ID ASC));
GO

--create index
CREATE NONCLUSTERED INDEX IX_SPATIAL_INDEXTABLE_on_ID
    ON SPATIAL_INDEXTABLE (ID);
GO

CREATE SPATIAL INDEX SIndx_SPATIAL_INDEXTABLE_on_GeometryCol
   ON SPATIAL_INDEXTABLE(GeometryCol)
   WITH ( BOUNDING_BOX = ( 0, 0, 500, 200 ) );
GO

CREATE SPATIAL INDEX SIndx_SPATIAL_INDEXTABLE_on_GeographyObject
   ON SPATIAL_INDEXTABLE(GeographyObject)
   USING GEOGRAPHY_GRID
   WITH (
    GRIDS = (MEDIUM, LOW, MEDIUM, HIGH ),
    CELLS_PER_OBJECT = 64,
    PAD_INDEX  = ON );
GO;

EXEC DBTD_ASSERT_INDEX_SPATIAL 'SIndx_SPATIAL_INDEXTABLE_on_GeometryCol',
       'SPATIAL_INDEXTABLE', 'Issues with index';
EXEC DBTD_ASSERT_INDEX_SPATIAL 'SIndx_SPATIAL_INDEXTABLE_on_GeographyObject', 
       'SPATIAL_INDEXTABLE', 'Issues with index';

See Also