SQL Flow Field Guide

geography.HasZ

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

spatial method HasZ (instance.HasZ(...))

What changes

Input
spatial instance (and arguments)
Output or change
bit
Return type
SQL Server return type: bit CLR return type: Boolean

Syntax at a glance

.HasZ

Work example

Use geography.HasZ to check whether elevation coordinates are present.

Document the vertical reference before using Z in calculations. Keep the geography type and SRID in the review.

Check your work HasZ is 1 because the sample point carries elevation value 10.3.

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.HasZ AS has_elevation 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.