Home > Enterprise >  Add geometry column from exisiting x,y,z columns
Add geometry column from exisiting x,y,z columns

Time:11-25

I have a table as such:

enter image description here

All columns are Decimal(18, 3), there are also millions of rows.

I would like to add a fourth column to be a geometry point. I have tried but to no avail:

 alter table [dbo].[o5bim] add ogr_geometry as geometry::STGeomFromText('Point(' column1 ' ' column2 ' ' column3 ')', 0)

Driving me insane! Cheers

CodePudding user response:

As mentioned by @lptr in the comments, you can use STPointFromText

alter table dbo.[o5bim]
  add ogr_geometry as
    geometry::STPointFromText(concat('POINT (', column1, ' ', column2, ' ', column3, ')'), 0);  

db<>fiddle

  • Related