Load Points from SQL Server Multipoint Data Type to Table

I am kicking off the idea of ​​using a new geometry datatype to represent a vector in a database. The multipoint geometry datatype will work well for this, but my question is, is there a way to populate a two column table with x, y values ​​in a multipoint join where each point is a row in the table and the X and Y point values ​​go to columns 1 and column 2 respectively?

0


source to share


2 answers


I'm assuming you've read Getting Started with a Geometry Data Type.

http://msdn.microsoft.com/en-us/library/bb895270.aspx



Also, I can't help it anymore.

0


source


It revealed:



select
mp.id
,mp.vector.STPointN(nums.number).STX
,mp.vector.STPointN(nums.number).STY
,nums.number
from tblWithMultiPoints mp --table with an int id, and a multipoint called vector
,#NUMBERS nums --temp table with 1 - max num of points in any multipoint
where nums.number <= mp.vector.STNumPoints()

      

0


source







All Articles