SqlServer 批量插入数据


declare @x decimal(18,8),@y decimal(18,8),@id int
set @x=113.69920700
set @y=34.76099100
set @id=0
while @id<30000
begin
insert into xy(x,y)
values (@x+CAST(@id AS FLOAT)/100000,@y+CAST(@id AS FLOAT)/100000)  
set @id=@id + 1
end

另外加上经纬度换算距离

select * from 
(select 
       (6378137.0 * ACOS(SIN(34.760991/ 180 * PI()) * SIN(y / 180 * PI()) +
                         COS(34.760991/ 180 * PI()) * COS(y / 180 * PI()) *
                         COS((113.699207 - x) / 180 * PI()))) as distance
  from xy ) t where t.distance<=200

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM