DECLARE
@deviationtime int,
@actualtime datetime,
@estimatedtime datetime
While (Select TOp 1 successrate FROM YBS_Tahmin_Kayit where deviationtime = 999 order by recordtime desc) = 999
BEGIN
SET @actualtime= (SELECT Top 1 actualtime From [TTS].[dbo].YBS_Tahmin_Kayit where deviationtime = 999 order by recordtime Desc )
SET @estimatedtime = (SELECT Top 1 estimatedtime From [TTS].[dbo].YBS_Tahmin_Kayit where deviationtime = 999 order by recordtime Desc )
SET @deviationtime = ABS(DATEDIFF(second, @actualtime, @estimatedtime))
Update [TTS].[dbo].YBS_Tahmin_Kayit SET deviationtime = @deviationtime where deviationtime = 999 and estimatedtime= @estimatedtime
end
我在数据库中设置了所有偏差时间= 999。
我希望从数据库更新所有偏差时间,但我的代码逐一进行。