DROP PROCEDURE IF EXISTS uspIsLetezoFelhasznalonev
GO

CREATE PROCEDURE uspIsLetezoFelhasznalonev
  @pUserName INT
AS
BEGIN
  SET NOCOUNT ON;

  SELECT f.ID
  FROM T_FELHASZNALOBELEPES_OSSZES f
  INNER JOIN T_TANEV_OSSZES t ON t.ID = f.C_TANEVID
    AND t.C_INTEZMENYID = f.C_INTEZMENYID
    AND t.C_AKTIV = 'T'
    AND t.TOROLT = 'F'
  WHERE f.C_BEJELENTKEZESINEV = @pUserName
    AND f.TOROLT = 'F'
END
GO


