SQL Server - Significance of 99999 here - Asked By Amit Choudhary on 02-Dec-14 11:22 AM

In below code Significance of 99999 here:

PROCEDURE RethrowError
AS 
BEGIN
--$Header: /Main2/Database/Procedures/RethrowError.sp 2     9/17/12 12:09p Sweety $
SET NOCOUNT ON

DECLARE @errorMessage    NVARCHAR(4000),
@errorNumber     INTEGER,
@errorSeverity   INTEGER,
@errorState      INTEGER,
@errorLine       INTEGER,
@errorProcedure  NVARCHAR(200);

--------------------------
--1. Get All Error Value--
--------------------------
SELECT @errorNumber = ERROR_NUMBER(),
@errorSeverity = ERROR_SEVERITY(),
@errorState = ERROR_STATE(),
@errorLine = ERROR_LINE(),
@errorProcedure = ISNULL(ERROR_PROCEDURE(), '-'),
@errorMessage = ERROR_MESSAGE();

---------------------------------
--2. Insert Data in Error Table--
---------------------------------
EXEC SetDataError @ErrorNumber = @ErrorNumber,
@ErrorSeverity = @ErrorSeverity,
@ErrorState = @ErrorState,
@ErrorLine = @ErrorLine,
@ErrorProcedure = @ErrorProcedure,
@ErrorMessage = @ErrorMessage

IF @ErrorNumber BETWEEN 50001 AND 50100
RAISERROR(50001, @ErrorSeverity, @ErrorState, @ErrorMessage)
ELSE
RAISERROR(99999, @ErrorSeverity, @ErrorState, @ErrorMessage) 

END

Robbe Morris replied to Amit Choudhary on 02-Dec-14 11:36 AM
It isn't really significant other than it is typically aligned with a system failure versus raising an error code driven by your apps business logic.  It is just an error code.