Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 2.02 KB

stisvalid-geometry-data-type.md

File metadata and controls

56 lines (42 loc) · 2.02 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
STIsValid (geometry Data Type)
STIsValid (geometry Data Type)
MladjoA
mlandzic
08/03/2017
sql
t-sql
reference
STIsValid (geometry Data Type)
STIsValid_TSQL
STIsValid (geometry Data Type)
TSQL
=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

STIsValid (geometry Data Type)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

Returns true if a geometry instance is well-formed, based on its Open Geospatial Consortium (OGC) type. Returns false if a geometry instance is not well-formed.

Syntax

  
.STIsValid ( )  

Return Types

[!INCLUDEssNoVersion] return type: bit

CLR return type: SqlBoolean

Remarks

The OGC type of a geometry instance can be determined by invoking STGeometryType().

[!INCLUDEssNoVersion] produces only valid geometry instances, but allows for the storage and retrieval of invalid instances. A valid instance representing the same point set of any invalid instance can be retrieved using the MakeValid() method.

Examples

The following example creates a geometry instance and uses STIsValid() to test if the instance is valid.

DECLARE @g geometry;  
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);  
SELECT @g.STIsValid();  

See Also

STGeometryType (geometry Data Type)
MakeValid (geometry Data Type)
OGC Methods on Geometry Instances