﻿IF EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCI_OrarendiOra_IntezmenyId_TanevId_TantargyId_TanarId_HetirendId_Torolt')
  DROP INDEX T_ORARENDIORA.NCI_OrarendiOra_IntezmenyId_TanevId_TantargyId_TanarId_HetirendId_Torolt
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCI_OrarendiOra_IntezmenyId_TanevId_TantargyId_TanarId_HetirendId_Torolt') BEGIN
  CREATE NONCLUSTERED INDEX NCI_OrarendiOra_IntezmenyId_TanevId_TantargyId_TanarId_HetirendId_Torolt
    ON T_ORARENDIORA (
       C_INTEZMENYID
      ,C_TANEVID
      ,C_TANTARGYID
      ,C_TANARID
      ,C_HETIREND
      ,TOROLT
     )
    INCLUDE (C_HETNAPJA,C_ORASZAM,C_ORAERVENYESSEGKEZDETE,C_ORAERVENYESSEGVEGE,C_ORAKEZDETE,C_ORAVEGE,C_IMPORTALT,C_TEREMID,C_OSZTALYCSOPORTID)
    WHERE TOROLT='F'
    WITH (FILLFACTOR = 80)
END
GO
