title: sql query Polygon of Points in MSSQL
body: <p>Below query successfully executes in MySQL but throwing an error in MSSQL as equivalent functions may not exist. </p>
  
  <p>Can anybody provide me an example to equivalent query in MSSQL 2012 ?</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Can we please get equivalent polygon query converted to MSSQL. </p>
  
  <p>for MSSQL to find the POINT; <code>select Geometry::Point(startIp, -1, 4326) from geo_tmp works</code>., but it is not equivalent to polygon query written above in mysql. </p>