﻿UPDATE T_ORARENDIORA SET C_ORAKEZDETE = CAST(CAST(C_ORAKEZDETE AS TIME) AS DATETIME)
WHERE C_ORAKEZDETE >= '19010102'
GO

UPDATE T_ORARENDIORA SET C_ORAVEGE = CAST(CAST(C_ORAVEGE AS TIME) AS DATETIME)
WHERE C_ORAVEGE >= '19010102'
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'IX_TANITASIORA_TANTARGYID_OSZTALYCSOPORTID_TANARID' ) BEGIN
  CREATE NONCLUSTERED INDEX [IX_TANITASIORA_TANTARGYID_OSZTALYCSOPORTID_TANARID] 
  ON dbo.T_TANITASIORA (
     C_TANTARGYID
    ,C_OSZTALYCSOPORTID
    ,C_TANARID
  ) INCLUDE (
     C_MEGTARTOTT
    ,C_SORSZAMOZANDO
    ,C_ORAKEZDETE
    ,C_INTEZMENYID
  ) 
  WHERE TOROLT = 'F'
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'IX_HAZIFELADATOK_FELADASDATUMA_OSZTALYCSOPORTID_TANTARGYID' ) BEGIN
  CREATE NONCLUSTERED INDEX IX_HAZIFELADATOK_FELADASDATUMA_OSZTALYCSOPORTID_TANTARGYID 
  ON T_HAZIFELADATOK (
     C_FELADASDATUMA
    ,C_OSZTALYCSOPORTID
    ,C_TANTARGYID
  ) INCLUDE (
     C_ROGZITOID
    ,C_ORASZAM
  )
  WHERE TOROLT = 'F'
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name='UK_DICTIONARYITEMBASE_INTEZMENYID_TANEVID_TYPE_NAME' 
  AND object_id = OBJECT_ID('T_DICTIONARYITEMBASE'))
BEGIN
  CREATE UNIQUE INDEX UK_DICTIONARYITEMBASE_INTEZMENYID_TANEVID_TYPE_NAME 
  ON T_DICTIONARYITEMBASE (
	 C_INTEZMENYID
	,C_TANEVID
	,C_TYPE
	,C_NAME
  ) INCLUDE (
	 C_VALUE
	,C_ORDER
  ) 
  WHERE TOROLT = 'F'
END
GO
