﻿--Migration
--Migration
DECLARE @intezmenyId int, @tanevId int
DECLARE TanevCursor CURSOR LOCAL FOR
SELECT i.ID, tv.ID
FROM T_TANEV tv
INNER JOIN T_INTEZMENY i ON i.ID = tv.C_INTEZMENYID
WHERE tv.TOROLT = 'F' AND i.TOROLT = 'F' AND tv.C_AKTIV = 'T'

OPEN TanevCursor
FETCH NEXT FROM TanevCursor INTO @intezmenyId, @tanevId

WHILE @@FETCH_STATUS = 0 BEGIN
  EXEC dbo.uspGenerateOrarend @intezmenyId, @tanevId
  FETCH NEXT FROM TanevCursor INTO @intezmenyId, @tanevId
END

CLOSE TanevCursor
DEALLOCATE TanevCursor
GO