SQL Flow Field Guide

geography.Z

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

spatial method Z (instance.Z(...))

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

.Z

Work example

Read the Z ordinate from a geography instance that carries elevation coordinates.

Check HasZ and document the vertical reference before using the value in calculations.

Check your work The Z ordinate is 10.3; the geography SRID does not define its vertical datum.

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.Z AS elevation_value 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.