Saturday, March 20, 2010

Examples About Spatial Data SQL08

-- Execute a query that inserts the following values into the Store table by using the Parse method of the geography data type

INSERT INTO Store (StoreName, StoreAddress, StorePhone, StoreLocation) VALUES ('Parts Supply', '2532 Fairgrounds Road, West Kingston, RI 02892', '623-555-0153', geography::Parse('POINT(-71.548531 41.497478)'))

---------------------------------------------------------------------------------------

-- Execute a query that inserts the following values into the Store table by using the Point method of the geography data type

INSERT INTO Store (StoreName, StoreAddress, StorePhone, StoreLocation) VALUES ('Two Bike Shops', '4567 9th Street SW, Puyallup, WA 98371', '724-555-0161', geography::Point('47.156622', '-122.30383', 4326))
---------------------------------------------------------------------------------------

-- Execute a query that inserts the following values into the Store table by using the STGeomFromText method of the geography data type

INSERT INTO Store (StoreName, StoreAddress, StorePhone, StoreLocation) VALUES ('Eastside Department Store', '9992 Whipple Rd, Union City, CA 94587', '926-555-0164', geography::STGeomFromText('POINT(-122.084552 37.603936)', 4326))

---------------------------------------------------------------------------------------

-- Execute a query that inserts the following values into the Store table by using the STGeomFromWKB method of the geography data type

INSERT INTO Store (StoreName, StoreAddress, StorePhone, StoreLocation) VALUES ('Fitness Hotel', '7901 France Ave S, Edina, MN 55410', '377-555-0132', geography::STGeomFromWKB(0x0101000000DC4603780B5557C0EF535568206E4640, 4326))

---------------------------------------------------------------------------------------

-- Execute a query that inserts the following values into the Store table by using the GeomFromGml method of the geography data type .

Please note: try to replace the symble '<' or '>' to '[' or ']'

INSERT INTO Store (StoreName, StoreAddress, StorePhone, StoreLocation) VALUES ('Aerobic Exercise Company', '39933 Mission Oaks Blvd, Camarillo, CA 93010', '244-555-0112', geography::GeomFromGml('[point xmlns="[a href="]http://www.opengis.net/gml[/a]"> [pos]34.235504 -118.988734[/pos] [/point]', 4326))

No comments: