DROP PROCEDURE  IF EXISTS uspGetErettsegiTantargyakForComboBox 
GO

CREATE PROCEDURE uspGetErettsegiTantargyakForComboBox
@pIntezmenyId INT
  ,@pTanevId INT
AS
BEGIN
  SET NOCOUNT ON;

  SELECT Tantargy.ID ID
    ,DictionaryItem.C_NAME Nev
  FROM T_ERETTSEGITANTARGY_OSSZES Tantargy
  LEFT JOIN T_DICTIONARYITEMBASE_OSSZES DictionaryItem ON DictionaryItem.ID = Tantargy.ID
    AND DictionaryItem.TOROLT = 'F'
  WHERE Tantargy.TOROLT = 'F'
    AND Tantargy.C_ALINTEZMENYID = @pIntezmenyId
    AND Tantargy.C_ALTANEVID = @pTanevId
    AND DictionaryItem.C_TANEVID = @pTanevId
  ORDER BY DictionaryItem.C_ORDER ASC
    ,Nev ASC
END
GO


