﻿DROP PROCEDURE IF EXISTS uspGetKovetkezoTanevAktivalhatosagAdatok
GO

CREATE PROCEDURE uspGetKovetkezoTanevAktivalhatosagAdatok
  @pIntezmenyId INT
AS
BEGIN
  SET NOCOUNT ON;
  
  SELECT
       C_AKTIVALHATOSAGKEZDETE
      ,C_KEZDONAP
  FROM T_TANEV_OSSZES
  WHERE
      TOROLT = 'F'
      AND C_SORSZAM =
      (SELECT C_SORSZAM + 2 FROM T_TANEV where C_AKTIV = 'T' and TOROLT = 'F' and C_INTEZMENYID = @pIntezmenyId)
      AND C_INTEZMENYID = @pIntezmenyId
      AND C_ISKIVALASZTHATO = 'T'
END

GO

