DROP PROCEDURE IF EXISTS uspGetAdatszotarMaxSorszam 
GO
  CREATE PROCEDURE uspGetAdatszotarMaxSorszam 
     @pType INT
    ,@pTanevId INT
    ,@pIntezmenyId INT
  AS
  BEGIN
    SET NOCOUNT ON;

    SELECT MAX(dib.C_ORDER) MaxSorszam
    FROM T_DICTIONARYITEMBASE_OSSZES dib
    WHERE dib.TOROLT = 'F'
      AND dib.C_DICTIONARYTYPEID = @pType
      AND dib.C_TANEVID = @pTanevId
      AND dib.C_INTEZMENYID = @pIntezmenyId
  END
GO


