﻿IF OBJECT_ID('fnGetDokumentumIntezmenyPedagogusok') IS NOT NULL BEGIN
  DROP FUNCTION fnGetDokumentumIntezmenyPedagogusok
END
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION fnGetDokumentumIntezmenyPedagogusok (@pIntezmenyId INT, @pTanevId INT)
  RETURNS TABLE
RETURN (
SELECT
    f.ID AS                 ID,
    f.C_NYOMTATASINEV       Nev
FROM T_ALKALMAZOTT_OSSZES a
    INNER JOIN T_FELHASZNALO_OSSZES f on f.ID = a.ID
WHERE
    f.TOROLT = 'F'
    AND f.C_TANEVID = @pTanevId
    AND f.C_INTEZMENYID = @pIntezmenyId
    )