probeer dit:(opmerking :de volgorde van de punten is belangrijk om de lijn correct te genereren.)
DECLARE @BuildString NVARCHAR(MAX)
SELECT @BuildString = COALESCE(@BuildString + ',', '') + CAST([Longitude] AS NVARCHAR(50)) + ' ' + CAST([Latitude] AS NVARCHAR(50))
FROM dbo.LongAndLats
ORDER BY SortOrder
SET @BuildString = 'LINESTRING(' + @BuildString + ')';
DECLARE @LineFromPoints geography = geography::STLineFromText(@BuildString, 4326);
SELECT @LineFromPoints