declare @TrackerNumber varchar(15)
declare @Date datetime
declare @Latitude float
declare @Longitude float
declare @Speed float
declare @Direction int
DECLARE temp2 CURSOR FOR
SELECT cast(TrackerNumber as varchar(15)),Date,cast(Latitude as float),cast(Longitude as float),cast(Speed as float),Direction FROM imei353327020471926
OPEN temp2;
--得到一行数据,并将其复制给本地变
FETCH FROM temp2 INTO @TrackerNumber, @Date,@Latitude,@Longitude,@Speed,@Direction;
insert into GpsTrackerData(Gps_Imei,Gps_Datatime,Gps_Latitude,Gps_Longitude,Gps_Speed,Gps_Direction) values(@TrackerNumber, @Date,@Latitude,@Longitude,@Speed,@Direction);
--SQLSTATE 00000: 操作执行成功并且未产生任何类型的警告或异常情况。
--通过这个可以检查是否到达最后一行
while @@FETCH_STATUS=0
begin
FETCH FROM temp2 INTO @TrackerNumber, @Date,@Latitude,@Longitude,@Speed,@Direction; --在WHILE逻辑中得到更多的行数据
insert into GpsTrackerData(Gps_Imei,Gps_Datatime,Gps_Latitude,Gps_Longitude,Gps_Speed,Gps_Direction) values(@TrackerNumber, @Date,@Latitude,@Longitude,@Speed,@Direction);
end
close temp2
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。