IF OBJECT_ID('dbo.sp_UpdateOrarendiOraVisszamenolegesen') IS NOT NULL BEGIN
  DROP PROCEDURE dbo.sp_UpdateOrarendiOraVisszamenolegesen
END
GO

CREATE PROCEDURE dbo.sp_UpdateOrarendiOraVisszamenolegesen
   @csengetesiRendOraId int
AS
BEGIN

	DECLARE @Oraszam int; DECLARE @Kezdete datetime; DECLARE @Vege datetime;
	SELECT @Oraszam = C_ORASZAM, @Kezdete = C_KEZDETE, @Vege = C_VEGE FROM T_CSENGETESIRENDORA WHERE ID = @csengetesiRendOraId
	
	UPDATE oo
	SET
		C_ORAKEZDETE = @Kezdete
		,C_ORAVEGE = @Vege
		,C_ORASZAM = @Oraszam
	FROM T_ORARENDIORA oo
	WHERE
		oo.C_CSENGETESIRENDORAID = @csengetesiRendOraId

END
GO