﻿DROP PROCEDURE IF EXISTS uspUpdateTanitasiOraOrarendiOraGroupIds
GO

CREATE PROCEDURE uspUpdateTanitasiOraOrarendiOraGroupIds
    @pDatumtol datetime
   ,@pDatumig datetime
   ,@pOrarendiOraId int
   ,@pOrarendiOraGroupId int
   ,@pModifier int
AS BEGIN
    SET NOCOUNT ON;

    UPDATE T_TANITASIORA
    SET C_ORARENDIORAGROUPID = NULL 
       ,LASTCHANGED = GETDATE()
       ,SERIAL += 1
       ,MODIFIER = @pModifier
    WHERE C_ORARENDIORAGROUPID in (@pOrarendiOraId,@pOrarendiOraGroupId)
      AND C_DATUM >= @pDatumtol
      AND (C_DATUM <= @pDatumig OR (@pDatumig IS NULL AND C_DATUM = @pDatumtol))


END
GO
