﻿DROP INDEX IF EXISTS NCU_CsengetesiRendOra_CsengetesiRendId_OraSzam  ON T_CSENGETESIRENDORA
GO
DROP INDEX IF EXISTS NCI_TanitasiOra_OsztalyCsoportId_IntezmenyId_TanevId_TantargyId ON T_TANITASIORA
GO  
DROP INDEX IF EXISTS NCI_TanitasiOra_Datum_TanarId_OsztalyCsoportId_IntezmenyId_TanevId ON T_TANITASIORA
GO
DROP INDEX IF EXISTS NCI_TanitasiOra_Datum_HelyettesitoTanarId_OsztalyCsoportId_IntezmenyId_TanevId ON T_TANITASIORA
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCU_CsengetesiRendOra_CsengetesiRendId_OraSzam') BEGIN
  CREATE INDEX NCU_CsengetesiRendOra_CsengetesiRendId_OraSzam 
    ON T_CSENGETESIRENDORA (
       C_CSENGETESIRENDID
      ,C_ORASZAM
    )
    INCLUDE (C_TANEVID, C_INTEZMENYID) 
  WHERE TOROLT = 'F'
  WITH (FILLFACTOR = 80)
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCI_HelyettesitesiIdoszak_HelyettesTanarokId_HelyettesitesNapja_IntezmenyId') BEGIN
  CREATE INDEX NCI_HelyettesitesiIdoszak_HelyettesTanarokId_HelyettesitesNapja_IntezmenyId
    ON T_HELYETTESITESIIDOSZAK (
       C_HELYETTESTANAROKID, C_HELYETTESITESNAPJA, C_INTEZMENYID
    )
    INCLUDE (C_TANEVID, C_HELYETTESITETTORARENDID) 
  WHERE TOROLT = 'F'
  WITH (FILLFACTOR = 80)
END
GO


IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCI_TanevRendje_TanevId_IntezmenyId_Datum') BEGIN
  CREATE INDEX NCI_TanevRendje_TanevId_IntezmenyId_Datum
    ON T_TANEVRENDJE (
       C_TANEVID, C_INTEZMENYID, C_DATUM
    )
    INCLUDE (C_OSSZESCSOPORTRAVONATKOZIK) 
  WHERE TOROLT = 'F'
  WITH (FILLFACTOR = 80)
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCI_TanitasiOra_TanarId_Datum_TanevId') BEGIN
  CREATE INDEX NCI_TanitasiOra_TanarId_Datum_TanevId
    ON T_TANITASIORA (
       C_TANARID, C_DATUM, C_TANEVID
    )
    INCLUDE (C_INTEZMENYID, C_OSZTALYCSOPORTID) 
  WHERE TOROLT = 'F'
  WITH (FILLFACTOR = 80)
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCI_TanitasiOra_HelyettesitoTanarId_Datum_TanevId') BEGIN
  CREATE INDEX NCI_TanitasiOra_HelyettesitoTanarId_Datum_TanevId
    ON T_TANITASIORA (
       C_HELYETTESITOTANARID, C_DATUM, C_TANEVID
    )
    INCLUDE (C_INTEZMENYID, C_OSZTALYCSOPORTID) 
  WHERE TOROLT = 'F'
  WITH (FILLFACTOR = 80)
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCI_TanitasiOra_OsztalyCsoportId_Datum_TanevId_IntezmenyId') BEGIN
  CREATE INDEX NCI_TanitasiOra_OsztalyCsoportId_Datum_TanevId_IntezmenyId
    ON T_TANITASIORA (
       C_OSZTALYCSOPORTID, C_DATUM, C_TANEVID, C_INTEZMENYID
    )
    INCLUDE (C_TANTARGYID) 
  WHERE TOROLT = 'F'
  WITH (FILLFACTOR = 80)
END
GO


