根据sqlserver geometry数据定义获取空间类型边界范围
--获取指定街道边界的xy最大最小值 declare @point_cnt int,@i int,@point geometry,@jdcode nvarchar(50) set @jdcode='440307006'--街道编码 create table #temp_point(id int identity,x float,y float) select @point_cnt =geom.STNumPoints() from [dbo].[jd] where jdcode=@jdcode set @i=1 while @i<=@point_cnt begin select @point = geom.STPointN(@i) from [dbo].[jd] where jdcode=@jdcode insert into #temp_point(x,y) values(@point.STX,@point.STY) set @i = @i+1 end select min(x) as minx,min(y) as miny,max(x) as maxx,max(y) as maxy from #temp_point truncate table #temp_point; drop table #temp_point