--3Create tables with spatial data create TABLE X (vintNotNULLIdentity1,1) Primary key, Geog geography notNULL, Geogwkt asGeog. Stastext ())--4. Add spatial data insert into X (GEOG) VALUES (Geography::P Arse ('POLYGON ((-93.123 36.943, -93.126 36.953, -94.129 36.986, -93.123 36.943) )' ) ), --polygon, start and end coordinates must be the same, note that polygon must contain 2 brackets, otherwise error (Geography::P Arse ('Point ( -93.123 36.943)')), --Point Coordinates (geography::P Arse ('LINESTRING ( -93.123 36.943,-93.126 36.953)')) --two lines between coordinates--5- calculation of geographic dataSelectV, geogwkt, Geog. Stdistance ('Point ( -93.123 36.985)'), --distance geog. Stintersects ('Point ( -93.123 36.943)'), --whether there is an intersection geog. Stlength (),--length Geog. Starea (),--Polygon Area Geog. Stastext ()--wkt Formatted coordinates fromx/*V geogwkt (no column name) (no column name) (no column name) (no column names) 1 POLYGON ((-93.123 36.943,-93.126 36.953, 94.129 36.986 , -93.123 36.943)) 3561.29978820883 1 180244.411606998 48996227.1008911 POLYGON (-93.123 36.943,-93.126 3 6.953, -94.129 36.986, -93.123 36.943) 2 point ( -93.123 36.943) 4661.03285004629 1 0 0 Point (-93.123 36 .943) 3 LINESTRING ( -93.123 36.943, -93.126 36.953) 3561.29978820883 1 1141.48450709835 0 LINESTRING (-93 .123 36.943, -93.126 36.953)*/Select* fromX
SQL Server Spatial data type