declare @vechilesimid varchar(50)
declare @longtitude float
declare @latitude float
declare @passengerstate int
declare @createdate datetime
declare @ID int
declare @PAS int
declare CS cursor for
select * from [Table_3]
open CS
fetch next from CS into @vechilesimid,@longtitude,@latitude,@passengerstate,@createdate,@ID
WHILE (@@FETCH_STATUS = 0)
begin
if @PAS!=@passengerstate
Begin
print'车牌:'+@vechilesimid;
print'经度:'+Convert(Varchar(50),@longtitude);
print'纬度:'+Convert(Varchar(50),@latitude);
print'乘客数:'+Convert(Varchar(50),@passengerstate);
print'时间:'+Convert(Varchar(50),@createdate,121);
print'序号:'+Convert(Varchar(10),@ID)
End
select @PAS=@passengerstate
fetch next from CS into @vechilesimid,@longtitude,@latitude,@passengerstate,@createdate,@ID
end
close cs
DEALLOCATE cs