kreta/Kreta.DataAccess.Migrations/Scripts/20220505102453_DB_4603/script.sql
2024-03-13 00:33:46 +01:00

34 lines
No EOL
745 B
Transact-SQL

set ansi_warnings off;
declare @IntezmenyId int, @TanevId int;
declare @cursor cursor;
set @cursor = cursor static for
select i.ID as INTEZMENYID, t.ID as TANEVID
from T_INTEZMENY i
inner join T_TANEV t on t.C_INTEZMENYID = i.ID
where i.TOROLT = 'F'
and t.TOROLT = 'F'
and t.C_AKTIV = 'T'
order by 1, 2;
truncate table T_ORARENDTELJES;
open @cursor;
fetch next from @cursor into @IntezmenyId, @TanevId;
while(@@fetch_status = 0)
begin
print concat('Orarend: ', @IntezmenyId, ', ', @TanevId);
exec dbo.uspGenerateTeljesOrarend @IntezmenyId, @TanevId;
fetch next from @cursor into @IntezmenyId, @TanevId;
end
close @cursor;
go
alter index all on T_ORARENDTELJES rebuild;
go
set ansi_warnings on;