SQL Flow Field Guide

geography.ToString

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

spatial method ToString (instance.ToString(...))

What changes

Input
spatial instance (and arguments)
Output or change
nvarchar(max)
Return type
SQL Server return type: nvarchar(max) CLR return type: SqlString

Syntax at a glance

.ToString ()

Work example

Use geography.ToString to display a spatial instance as readable text.

Use explicit export when a contract needs WKT, WKB, GML, Z, or M. Keep the geography type and SRID in the review.

Check your work The string representation includes the point's Z and M ordinates.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

SELECT p.shape.ToString() AS geography_text FROM (VALUES (geography::STGeomFromText('POINT(-122.34900 47.65100 10.3 12)', 4326))) AS p(shape);

Open Microsoft Learn for full syntax, permissions, and details for your version.