I have got a table in an SQL Server 2008 R2 database. It contains X, Y and Shape columns for storing numeric(38, 8) for Longitude and Latitude and Computed Column for Geometry type. The idea is whenever X and Y are inserted, Shape column should automatically be filled with the correct Geometry data.
X and Y are populated. However, I have been unsuccessful in specifying the Shape column. In SQL Server Management Studio, it gave me errors of failing validating formula when I populated either of the following codes in Formula of Computed Column Specification:
(STGeomFromText('POINT (' + CAST([x] as varchar(32)) + ' ' + CAST([y] as varchar(32)) + ')', 4283))
OR
([STGeomFromText]('POINT (' + CAST([x] as varchar(32)) + ' ' + CAST([y] as varchar(32)) + ')', 4283))
Could anyone give me a hand? Thanks!
Cheers,
Alex
I was actually then enlightened by this post.
Hope it helps to anybody else who has the same question.