0

A similar question has been asked here:

Create geography polyline from points in T-SQL

I have a table schema that looks like this:

CREATE TABLE [dbo].[LongAndLats](
[Longitude] [float] NULL,
[Latitude] [float] NULL,
[SortOrder] [bigint] NULL,
[SensorID] [bigint] NULL,
)

Sample data looks like this:

enter image description here

How can I convert these points into a geography polyline for each SensorID using TSQL (so that I would have a SensorID/Polyline record for each SensorID)?

user3799279
  • 143
  • 1
  • 11
  • One way would be to open a cursor on the distinct `SensorID`s and inside the cursor run the code in the duplicate answer, but adding a `WHERE` clause to filter on the `SensorID` – g2server Jan 12 '18 at 23:13
  • Thanks...I had a little success playing around with that thought. Being new to the cursor concept, how might one go about joining each result? Say I ultimately want a view with x rows as opposed to x result sets? – user3799279 Jan 13 '18 at 00:13

0 Answers0