IF OBJECT_ID('CK_Telefon_Alapertelemetett_Gondivselo', 'C') IS NULL BEGIN
  ALTER TABLE T_TELEFON
  ADD CONSTRAINT CK_Telefon_Alapertelemetett_Gondivselo
  CHECK (TOROLT = 'T' OR C_GONDVISELOID IS NULL OR C_ALAPERTELMEZETT = 'T')
END
GO

IF OBJECT_ID('CK_Email_Alapertelemetett_Gondivselo', 'C') IS NULL BEGIN
  ALTER TABLE T_EMAIL
  ADD CONSTRAINT CK_Email_Alapertelemetett_Gondivselo
  CHECK (TOROLT = 'T' OR C_GONDVISELOID IS NULL OR C_ALAPERTELMEZETT = 'T')
END
GO