SQL Flow Field Guide

geography.AsTextZM

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

spatial method AsTextZM (instance.AsTextZM(...))

What changes

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

Syntax at a glance

.AsTextZM ()

Work example

Use geography.AsTextZM to export readable text with Z and M ordinates.

Check whether the receiving parser preserves extra ordinates. Keep the geography type and SRID in the review.

Check your work The WKT output retains longitude, latitude, Z 10.3, and M 12 in that order.

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.AsTextZM() AS point_wkt_zm 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.