Converts the geometry to a linestring.
SELECT Shape.ST_Length() FROM SpatialShapes WHERE ShapeID = 5
The following uses ST_ToLineString to change the type of the Shape column expression to ST_LineString. ST_Length returns the result 7.
SELECT Shape.ST_ToLineString().ST_Length() FROM SpatialShapes WHERE ShapeID = 5
In this case, the value of the Shape column is known be of type ST_LineString, so TREAT can be used to efficiently change the type of the expression. ST_Length returns the result 7.
SELECT TREAT( Shape AS ST_LineString ).ST_Length() FROM SpatialShapes WHERE ShapeID = 5
SQL/MM (ISO/IEC 13249-3: 2006) 5.1.33