1

I want to insert GEOMETRY values into a table. For which I have a table with three columns as shown below:

Table: geo

create table geo
(
p1 float,
p2 float,
Paths GEOMETRY
);

Input values: I have following values

p1 = 22.9901232886963
p2 = 87.5953903123242

My bad try:

INSERT INTO geo(Paths)
VALUES (geometry::STGeomFromText('POLYGON (22.9901232886963,87.5953903123242)', 4326));
JumpingJezza
  • 5,498
  • 11
  • 67
  • 106
MAK
  • 6,824
  • 25
  • 74
  • 131
  • STGeomFromText is Function ..?? – Dhaval Dec 24 '14 at 07:23
  • Right now, your data doesn't make sense. Specifically, what do p1 and p2 represent? Are they the X & Y coordinates of some point? Something else? Also, since it appears that you're specifying an SRID, do you mean to be using the geography datatype instead of geometry? – Ben Thul Dec 24 '14 at 11:19
  • @Ben Thul, Yes they are X & Y of the point. – MAK Dec 24 '14 at 11:19

1 Answers1

3

Your WKT is malformed. This works for me:

declare @g geometry = geometry::STGeomFromText(
    'POINT (22.9901232886963 87.5953903123242)'
    , 4326);

select @g

Note too that it's a point and not a polygon.

Ben Thul
  • 31,080
  • 4
  • 45
  • 68