﻿IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANULOTANUGYIADATOK' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_TanuloTanugyiAdatok_TanuloCsoportId_IntezmenyId_TanevId ON T_TANULOTANUGYIADATOK (C_TANULOCSOPORTID, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANULOTANUGYIADATOK' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_TanuloTanugyiAdatok_TanuloCsoportId_AlintezmenyId_AltanevId ON T_TANULOTANUGYIADATOK (C_TANULOCSOPORTID, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_TanuloTanugyiAdatok_TanuloCsoportId ON T_TANULOTANUGYIADATOK (C_TANULOCSOPORTID) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DOKUMENTUM' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Dokumentum_IktatottDokumentumId_IntezmenyId_TanevId ON T_DOKUMENTUM (C_IKTATOTTDOKUMENTUMID, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DOKUMENTUM' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Dokumentum_IktatottDokumentumId_AlintezmenyId_AltanevId ON T_DOKUMENTUM (C_IKTATOTTDOKUMENTUMID, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Dokumentum_IktatottDokumentumId ON T_DOKUMENTUM (C_IKTATOTTDOKUMENTUMID) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_CREDITCARDREPLY' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_CreditCardReply_CreditCardPaymentId_IntezmenyId_TanevId ON T_CREDITCARDREPLY (C_CREDITCARDPAYMENTID, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_CREDITCARDREPLY' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_CreditCardReply_CreditCardPaymentId_AlintezmenyId_AltanevId ON T_CREDITCARDREPLY (C_CREDITCARDPAYMENTID, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_CreditCardReply_CreditCardPaymentId ON T_CREDITCARDREPLY (C_CREDITCARDPAYMENTID) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_AMITANTARGYSABLON' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_AMITantargySablon_Nev_IntezmenyId_TanevId ON T_AMITANTARGYSABLON (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_AMITANTARGYSABLON' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_AMITantargySablon_Nev_AlintezmenyId_AltanevId ON T_AMITANTARGYSABLON (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_AMITantargySablon_Nev ON T_AMITANTARGYSABLON (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DASHBOARDUZENET' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DashboardUzenet_EgyediAzonosito_IntezmenyId_TanevId ON T_DASHBOARDUZENET (C_EGYEDIAZONOSITO, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DASHBOARDUZENET' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DashboardUzenet_EgyediAzonosito_AlintezmenyId_AltanevId ON T_DASHBOARDUZENET (C_EGYEDIAZONOSITO, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_DashboardUzenet_EgyediAzonosito ON T_DASHBOARDUZENET (C_EGYEDIAZONOSITO) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Nev_IntezmenyId_TanevId ON T_FENNTARTO (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Nev_AlintezmenyId_AltanevId ON T_FENNTARTO (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Nev ON T_FENNTARTO (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_INTEZMENY' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Intezmeny_Azonosito_IntezmenyId_TanevId ON T_INTEZMENY (C_AZONOSITO, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_INTEZMENY' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Intezmeny_Azonosito_AlintezmenyId_AltanevId ON T_INTEZMENY (C_AZONOSITO, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Intezmeny_Azonosito ON T_INTEZMENY (C_AZONOSITO) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_CSENGETESIREND' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_CsengetesiRend_Aktiv_Nev_IntezmenyId_TanevId ON T_CSENGETESIREND (C_AKTIV, C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_CSENGETESIREND' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_CsengetesiRend_Aktiv_Nev_AlintezmenyId_AltanevId ON T_CSENGETESIREND (C_AKTIV, C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_CsengetesiRend_Aktiv_Nev ON T_CSENGETESIREND (C_AKTIV, C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTARGY' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tantargy_Nev_IntezmenyId_TanevId ON T_TANTARGY (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTARGY' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tantargy_Nev_AlintezmenyId_AltanevId ON T_TANTARGY (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Tantargy_Nev ON T_TANTARGY (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTERV' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tanterv_Nev_IntezmenyId_TanevId ON T_TANTERV (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTERV' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tanterv_Nev_AlintezmenyId_AltanevId ON T_TANTERV (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Tanterv_Nev ON T_TANTERV (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_MUKODESIHELY' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_MukodesiHely_Nev_IntezmenyId_TanevId ON T_MUKODESIHELY (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_MUKODESIHELY' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_MukodesiHely_Nev_AlintezmenyId_AltanevId ON T_MUKODESIHELY (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_MukodesiHely_Nev ON T_MUKODESIHELY (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FELHASZNALOBELEPES' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_FelhasznaloBelepes_BejelentkezesiNev_IntezmenyId_TanevId ON T_FELHASZNALOBELEPES (C_BEJELENTKEZESINEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FELHASZNALOBELEPES' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_FelhasznaloBelepes_BejelentkezesiNev_AlintezmenyId_AltanevId ON T_FELHASZNALOBELEPES (C_BEJELENTKEZESINEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_FelhasznaloBelepes_BejelentkezesiNev ON T_FELHASZNALOBELEPES (C_BEJELENTKEZESINEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCAPPLICATIONFORMBATCH' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCApplicationFormBatch_SerialNumber_IntezmenyId_TanevId ON T_SCAPPLICATIONFORMBATCH (C_SERIALNUMBER, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCAPPLICATIONFORMBATCH' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCApplicationFormBatch_SerialNumber_AlintezmenyId_AltanevId ON T_SCAPPLICATIONFORMBATCH (C_SERIALNUMBER, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_SCApplicationFormBatch_SerialNumber ON T_SCAPPLICATIONFORMBATCH (C_SERIALNUMBER) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCINSET' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCInset_SerialNumber_IntezmenyId_TanevId ON T_SCINSET (C_SERIALNUMBER, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCINSET' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCInset_SerialNumber_AlintezmenyId_AltanevId ON T_SCINSET (C_SERIALNUMBER, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_SCInset_SerialNumber ON T_SCINSET (C_SERIALNUMBER) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCTEMPORARYCARD' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCTemporaryCard_SerialNumber_IntezmenyId_TanevId ON T_SCTEMPORARYCARD (C_SERIALNUMBER, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCTEMPORARYCARD' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCTemporaryCard_SerialNumber_AlintezmenyId_AltanevId ON T_SCTEMPORARYCARD (C_SERIALNUMBER, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_SCTemporaryCard_SerialNumber ON T_SCTEMPORARYCARD (C_SERIALNUMBER) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCCARD' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCCard_SerialNumber_IntezmenyId_TanevId ON T_SCCARD (C_SERIALNUMBER, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_SCCARD' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_SCCard_SerialNumber_AlintezmenyId_AltanevId ON T_SCCARD (C_SERIALNUMBER, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_SCCard_SerialNumber ON T_SCCARD (C_SERIALNUMBER) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DICTIONARYITEMBASE' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DictionaryItemBase_Name_Type_IntezmenyId_TanevId ON T_DICTIONARYITEMBASE (C_NAME, C_TYPE, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DICTIONARYITEMBASE' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DictionaryItemBase_Name_Type_AlintezmenyId_AltanevId ON T_DICTIONARYITEMBASE (C_NAME, C_TYPE, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_DictionaryItemBase_Name_Type ON T_DICTIONARYITEMBASE (C_NAME, C_TYPE) WHERE TOROLT = 'F'
END
GO
