日期:2014-05-17 浏览次数:20562 次
DECLARE Test_Cur CURSOR SCROLL FOR
SELECT A.Vqm_MonPointId,A.CustName
,A.Lat2,A.Lon2,A.ErrorR
FROM Vqm_MonPoint A left join Vqm_MonPoint B ON A.UnitSId=b.UnitSId inner join Hr_Dep D on D.Hr_DepId=A.UnitSId inner join Vqm_PointLog c on(a.Vqm_MonPointId=c.Vqm_MonPointId) where
A.Vqm_MonPointId<>B.Vqm_MonPointId and v2.dbo.GetDistance(A.Lat2,A.Lon2,B.Lat2,B.lon2)<(A.ErrorR+B.ErrorR)
and
(c.EndMonTime is null or cast( c.EndMonTime as date ) >=cast(CAST(20121201 as varchar)as date ))
and c.StartMonTime is not null
and cast( c.StartMonTime as date )<=CAST(20121231 as varchar )
and A.UnitGName='青羊供电局'
OPEN Test_Cur
DECLARE @id NVARCHAR(60), @CustName VARCHAR(100),@Lat2 numeric(18, 9) , @Lon2 numeric(18, 9),@Error numeric(18, 9)
FETCH NEXT FROM Test_Cur INTO @id,@CustName,@Lat2,@Lon2,@Error
WHILE @@FETCH_STATUS=0
BEGIN
PRINT @id+' '+@CustName+' ||'+CAST(@Lat2 as VARCHAR(100))
----?????
FETCH NEXT FROM Test_Cur INTO @id,@CustName,@Lat2,@Lon2,@Error
END
CLOSE Test_Cur
DEALLOCATE Test_Cur