﻿SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF OBJECT_ID('[sp_SetAktivCsengetesiRend]') IS NOT NULL 
BEGIN
  DROP PROCEDURE [sp_SetAktivCsengetesiRend] 
END  
GO

CREATE PROCEDURE [sp_SetAktivCsengetesiRend]
	@CsengrendID int,
	@Aktival bit,
	@TanevId int
AS
BEGIN

	SET NOCOUNT ON;

	IF (@Aktival = 1)
		BEGIN
			update [T_CSENGETESIREND_OSSZES] set [C_AKTIV] = 'F' WHERE C_TANEVID = @TanevId;

			update [T_CSENGETESIREND_OSSZES] set [C_AKTIV] = 'T' where [ID] = @CsengrendID AND C_TANEVID = @TanevId;
		END
	ELSE
		BEGIN
			update [T_CSENGETESIREND_OSSZES] set [C_AKTIV] = 'F' where [ID] = @CsengrendID AND C_TANEVID = @TanevId;
		END
END
