SQL Flow Field Guide

geometry.M

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

spatial method M (instance.M(...))

What changes

Input
spatial instance (and arguments)
Output or change
SQL Server type: float
Return type
SQL Server type: float CLR type: SqlDouble

Syntax at a glance

.M

Work example

Use geometry.M to read the measure ordinate from a measured instance.

Check HasM and document what the measure represents. Keep the geometry type and SRID in the review.

Check your work M is 6 and records a measure. It is separate from X, Y, and Z.

Practice SQL

Open in SQL Flow

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

-- Planar geometry. SRID 0 coordinates here are synthetic units, not metres.
DECLARE @shape geometry;
SET @shape = geometry::STGeomFromText(N'POINT(3 4 5 6)', 0);
SELECT @shape.M AS measure_value, @shape.HasM AS has_measure,
       @shape.STSrid AS source_srid,
       @shape.STIsValid() AS source_is_valid;

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