﻿IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_ORARENDIORA_TEREMID_ORAERVENYESSEGKEZDETE_ORAERVENYESSEGVEGE_INTEZMENYID_TANEVID') BEGIN
  CREATE INDEX IX_ORARENDIORA_TEREMID_ORAERVENYESSEGKEZDETE_ORAERVENYESSEGVEGE_INTEZMENYID_TANEVID 
    ON T_ORARENDIORA (C_TEREMID, C_ORAERVENYESSEGKEZDETE, C_ORAERVENYESSEGVEGE, C_INTEZMENYID, C_TANEVID) 
    WHERE TOROLT = 'F'
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_TANITASIORA_TEREMID_DATUM_INTEZMENYID_TANEVID_INC_CSENGETESIRENDID') BEGIN
  CREATE INDEX IX_TANITASIORA_TEREMID_DATUM_INTEZMENYID_TANEVID_INC_CSENGETESIRENDID
    ON T_TANITASIORA (C_TEREMID, C_DATUM, C_INTEZMENYID, C_TANEVID) 
    INCLUDE (C_CSENGETESIRENDID) 
    WHERE TOROLT = 'F' 
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_ORARENDIORA_TANTARGYID_ORAERVENYESSEGKEZDETE_ORAERVENYESSEGVEGE_INTEZMENYID_TANEVID') BEGIN
  CREATE INDEX IX_ORARENDIORA_TANTARGYID_ORAERVENYESSEGKEZDETE_ORAERVENYESSEGVEGE_INTEZMENYID_TANEVID 
    ON T_ORARENDIORA (C_TANTARGYID, C_ORAERVENYESSEGKEZDETE, C_ORAERVENYESSEGVEGE, C_INTEZMENYID, C_TANEVID) 
    WHERE TOROLT = 'F'
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_TANITASIORA_TANTARGYID_DATUM_INTEZMENYID_TANEVID_INC_CSENGETESIRENDID') BEGIN
  CREATE INDEX IX_TANITASIORA_TANTARGYID_DATUM_INTEZMENYID_TANEVID_INC_CSENGETESIRENDID
    ON T_TANITASIORA (C_TANTARGYID, C_DATUM, C_INTEZMENYID, C_TANEVID) 
    INCLUDE (C_CSENGETESIRENDID) 
    WHERE TOROLT = 'F' 
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_OSZTALYCSOPORT_TANEVID_INTEZMENYID_INC_NEV_VEGZOSEVFOLYAM') BEGIN
  CREATE INDEX IX_OSZTALYCSOPORT_TANEVID_INTEZMENYID_INC_NEV_VEGZOSEVFOLYAM 
    ON T_OSZTALYCSOPORT (C_TANEVID, C_INTEZMENYID) 
    INCLUDE(C_NEV, C_VEGZOSEVFOLYAM) 
    WHERE TOROLT = 'F'
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_IGAZOLAS_TANULOID_KEZDETE_VEGE_INTEZMENYID_TANEVID') BEGIN
  CREATE INDEX IX_IGAZOLAS_TANULOID_KEZDETE_VEGE_INTEZMENYID_TANEVID 
    ON T_IGAZOLAS (C_TANULOID, C_KEZDETE, C_VEGE, C_INTEZMENYID, C_TANEVID) 
    WHERE TOROLT = 'F'
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_TANULOMENTESSEG_TANULOID_TANTARGYID_KEZDETE_VEGE_INTEZMENYID_TANEVID') BEGIN
  CREATE INDEX IX_TANULOMENTESSEG_TANULOID_TANTARGYID_KEZDETE_VEGE_INTEZMENYID_TANEVID 
    ON T_TANULOMENTESSEG (C_TANULOID, C_TANTARGYID, C_KEZDETE, C_VEGE, C_INTEZMENYID, C_TANEVID) 
    WHERE TOROLT = 'F'
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_GONDVISELO_TANULOID_INTEZMENYID_TANEVID_INC_NEV') BEGIN
  CREATE INDEX IX_GONDVISELO_TANULOID_INTEZMENYID_TANEVID_INC_NEV 
    ON T_GONDVISELO (C_TANULOID, C_INTEZMENYID, C_TANEVID) 
    INCLUDE (C_NEV) 
    WHERE TOROLT = 'F'
END

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE [name] = 'IX_TELEFON_GONDVISELOID_ALAPERTELMEZETT_INTEZMENYID_TANEVID_INC_TELEFONSZAM') BEGIN
  CREATE INDEX IX_TELEFON_GONDVISELOID_ALAPERTELMEZETT_INTEZMENYID_TANEVID_INC_TELEFONSZAM 
    ON T_TELEFON (C_GONDVISELOID, C_ALAPERTELMEZETT, C_INTEZMENYID, C_TANEVID) 
    INCLUDE (C_TELEFONSZAM) 
    WHERE TOROLT = 'F'
END
