sql-servertype-conversionpointmultipoint

Convert multipoint to point in SQL Server


I have a table in SQL Server where points are stored as a mix of point and multipoint although all are just points. Unfortunately, the multipoints are causing problems elsewhere, so I need to convert them to points.

Is there a simple procedure for this? I haven't been able to find one.


Solution

  • update MyTable set MyGeometry = MyGeometry.STGeometryN(1).STAsText() where MyGeometry.STAsText() like 'Multi%';