1

Below query successfully executes in MySQL but throwing an error in MSSQL as equivalent functions may not exist.

Can anybody provide me an example to equivalent query in MSSQL 2012 ?

CREATE TABLE geo_tmp
( startIp  varchar(12)    NOT NULL,
   endIp    varchar(12)    NOT NULL);    

INSERT INTO geo_tmp VALUES(16777216,16777471);   
INSERT INTO geo_tmp VALUES(16777472,16778239);   
INSERT INTO geo_tmp VALUES(16778240,16778271);   

select startIp,endIp, 
POLYGON(LINESTRING( POINT(startIp, -1), POINT(endIp,   -1), POINT(endIp,    1), POINT(startIp,  1), POINT(startIp, -1)))  
from geo_tmp

Can we please get equivalent polygon query converted to MSSQL.

for MSSQL to find the POINT; select Geometry::Point(startIp, -1, 4326) from geo_tmp works., but it is not equivalent to polygon query written above in mysql.

PM 77-1
  • 12,933
  • 21
  • 68
  • 111
Krishna
  • 11
  • 3

0 Answers0