1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00
Files
sql-server-samples/samples/features/json/geo-json/dotnet-states-openlayers2/sql-scripts/GetAllStates.sql
2016-12-03 10:29:47 +01:00

15 lines
443 B
SQL

select
'FeatureCollection' as [type],
(
select
'Feature' as [type],
[Border].AsGeoJSON() as [geometry],
[StateProvinceName] as [properties.name],
[StateProvinceCode] as [properties.code],
[Border].STArea() as [properties.area],
[LatestRecordedPopulation] as [properties.population]
from Application.StateProvinces
where StateProvinceName like 'A%'
for json path
) as [features]
for json path, without_array_wrapper