SQL Flow Field Guide

geography::STMLineFromText

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

static constructor STMLineFromText (called as type::STMLineFromText(...))

What changes

Input
WKT, WKB, GML or coordinates and SRID
Output or change
spatial instance
Return type
SQL Server return type: geography CLR return type: SqlGeography OGC type: MultiLineString

Syntax at a glance

STMLineFromText ( 'multilinestring_tagged_text' , SRID )

Work example

Use geography.STMLineFromText to construct a multi-line value from WKT.

Check component boundaries and shared coordinate reference. Keep the geography type and SRID in the review.

Check your work The WKT creates a MultiLineString with two line components and SRID 4326.

Practice SQL

Open in SQL Flow

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

SELECT geography::STMLineFromText('MULTILINESTRING((-122.358 47.653, -122.348 47.649), (-122.357 47.654, -122.349 47.657))', 4326).STNumGeometries() AS route_count;

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