Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Parse (geometry Data Type)


Applies To: SQL Server 2014, SQL Server 2016 Preview

Returns a geometry instance from an Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation. Parse() is equivalent to , with the exception that it assumes a spatial reference ID (SRID) of 0 as a parameter. The input may carry optional Z (elevation) and M (measure) values.

Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.

Parse ( 'geometry_tagged_text' )


Is the WKT representation of the geometry instance you wish to return. geometry_tagged_text is an nvarchar expression.

SQL Server return type: geometry

CLR return type: SqlGeometry

The OGC type of the geometry instance returned by Parse() is set to the corresponding WKT input.

The string 'Null' will be interpreted as a null geometry instance.

This method will throw a FormatException if the input is not well-formatted.

The following example uses Parse() to create a geometry instance.

DECLARE @g geometry; 
SET @g = geometry::Parse('LINESTRING (100 100, 20 180, 180 180)');
SELECT @g.ToString();

Community Additions

© 2015 Microsoft