I have a SQL Server database table to contains two geometry types: LineString; and, MultiLineString.

What is the best way to change the type of all of the LineString geometries to 1 part MultiLineString geometries?

I have tried:

UPDATE Footpaths SET Geom.STGeometryType() = 'MultiLineString';

  • No, that's a read-only property. You need to reload the geometry as a singleton multipart.
    – Vince
    Aug 28, 2017 at 22:22
  • This is for an original data set, so, reloading is not an option. Sep 7, 2017 at 2:20
  • You certainly can't change a geometry by putting a function on the left side of an assignment statement. UPDATEs fragment tables; far better to do an initial load to a staging table, then conditionally INSERT into a final table. So, not only is reloading an option, it's actually best practice.
    – Vince
    Sep 7, 2017 at 3:16

1 Answer 1


One solution I found was to set the geometry from text after reading the geometry as a text string and reformatting it:

UPDATE [GIS].[dbo].[Footpaths] SET [Geom] = geometry::STGeomFromText(CONCAT(REPLACE([Geom].STAsText(),'LINESTRING ', 'MULTILINESTRING ('),')'),28356) WHERE [Geom].STGeometryType() = 'LineString'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.