SQL Flow Field Guide

geometry.STSrid

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

spatial method STSrid (instance.STSrid(...))

What changes

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

Syntax at a glance

STSrid

Work example

Use geometry.STSrid to read the spatial reference identifier.

Compare SRIDs before combining two spatial values. Keep the geometry type and SRID in the review.

Check your work STSrid returns 0. It labels a reference and does not transform coordinates.

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)', 0);
SELECT @shape.STSrid AS spatial_reference_id,
       @shape.STSrid AS source_srid,
       @shape.STIsValid() AS source_is_valid;

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