DROP PROCEDURE IF EXISTS uspIsAlkalmazott 
GO
  CREATE PROCEDURE uspIsAlkalmazott
     @pUserId INT
    ,@pTanevId INT
  AS
  BEGIN
    SET NOCOUNT ON;

    IF EXISTS (
        SELECT 1
        FROM T_ALKALMAZOTT_OSSZES a
        INNER JOIN T_TANEV_OSSZES t ON t.ID = a.C_ALTANEVID
          AND t.C_AKTIV = 'T'
          AND t.TOROLT = 'F'
        WHERE a.ID = @pUserId
          AND a.C_ALTANEVID = @pTanevId
          AND a.TOROLT = 'F'
        )
      SELECT 1
    ELSE
      SELECT 0
  END
GO


