DISABLE TRIGGER tr_ORARENDIORALog ON T_ORARENDIORA
GO

DISABLE TRIGGER tr_TANITASIORALog ON T_TANITASIORA
GO

UPDATE T_ORARENDIORA_OSSZES
  SET C_ORARENDIORAGROUPID = ID
WHERE ID IN (
  SELECT TOP(1000) ID
  FROM T_ORARENDIORA_OSSZES
  WHERE C_ORARENDIORAGROUPID IS NULL)

WHILE @@ROWCOUNT <> 0 BEGIN
  UPDATE T_ORARENDIORA_OSSZES
    SET C_ORARENDIORAGROUPID = ID
  WHERE ID IN (
    SELECT TOP(1000) ID
    FROM T_ORARENDIORA_OSSZES
    WHERE C_ORARENDIORAGROUPID IS NULL)
END

GO

UPDATE T_TANITASIORA_OSSZES
  SET C_ORARENDIORAGROUPID = C_ORARENDIORAID
WHERE ID IN (
  SELECT TOP(1000) ID
  FROM T_TANITASIORA_OSSZES
  WHERE C_ORARENDIORAGROUPID IS NULL
    AND C_ORARENDIORAID IS NOT NULL)

WHILE @@ROWCOUNT <> 0 BEGIN
  UPDATE T_TANITASIORA_OSSZES
    SET C_ORARENDIORAGROUPID = C_ORARENDIORAID
  WHERE ID IN (
    SELECT TOP(1000) ID
    FROM T_TANITASIORA_OSSZES
    WHERE C_ORARENDIORAGROUPID IS NULL
	  AND C_ORARENDIORAID IS NOT NULL)
END


GO
ENABLE TRIGGER tr_ORARENDIORALog ON T_ORARENDIORA

GO
ENABLE TRIGGER tr_TANITASIORALog ON T_TANITASIORA