DROP PROCEDURE IF EXISTS [dbo].[uspGetOrarendiOraTulajdonsag]
GO

CREATE PROCEDURE [dbo].[uspGetOrarendiOraTulajdonsag]
   @pOrarendiOraId int
  ,@pTanevId int
AS BEGIN
  SET NOCOUNT ON;
  
SELECT
   ott.ID AS OraTulajdonsagId
  ,ISNULL(oot.C_BOOLERTEK, ott.C_BOOLDEFAULT) AS Ertek
FROM T_ORATULAJDONSAGTIPUS_OSSZES ott
  LEFT JOIN T_ORARENDIORATULAJDONSAG_OSSZES oot ON oot.C_ORATULAJDONSAGID = ott.ID AND oot.C_TANEVID = ott.C_ALTANEVID AND oot.TOROLT = 'F' AND oot.C_ORARENDIORAID = @pOrarendiOraId
WHERE ott.C_ALTANEVID = @pTanevId
  AND ott.TOROLT = 'F'

END