DROP PROCEDURE IN_SgteItemEnDetalleFormulaProc
GO
CREATE PROCEDURE IN_SgteItemEnDetalleFormulaProc
( @CORRNBR  int)
AS
BEGIN

    BEGIN TRAN
    DECLARE @VALOR INTEGER	
    SET  SELECT @VALOR = COUNT(*)+1 FROM TMP_IN_KITCOMPONENT WHERE CORRNBR=@CORRNBR
   

    IF (@@error!=0)
    BEGIN
        ROLLBACK TRAN
        RETURN(-1)
    END

    COMMIT TRAN
    RETURN(@VALOR)

END 