SQL Flow Field Guide

geometry::STMLineFromWKB

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

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

What changes

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

Syntax at a glance

STMLineFromWKB ( 'WKB_multilinestring' , SRID )

Work example

Use geometry.STMLineFromWKB to construct a multi-line value from WKB bytes.

Check expected line members and SRID. Keep the geometry type and SRID in the review.

Check your work The WKB constructor returns two lines in the same SRID 0 frame.

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 @payload varbinary(max);
SET @payload = geometry::STGeomFromText(N'MULTILINESTRING((0 0, 3 4),(10 0, 10 2))', 0).STAsBinary();
DECLARE @result geometry;
SET @result = geometry::STMLineFromWKB(@payload, 0);
SELECT @result.STAsText() AS multiline_wkt,
       @result.STSrid AS result_srid,
       @result.STIsValid() AS result_is_valid;

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