CREATE PROCEDURE [dbo].[sp_GetErrorMessages]
@errorId integer,
@strErrorMessage nvarchar(1000) OUTPUT
AS
/*
CREATED BY :
CREATED ON : 1 JULY 2010
PURPOSE : Getting Error message based on errorcode
INPUT : @@errorId - It is an error number
OUTPUT : @@@strErrorMessage - It is an error message
MODIFIED BY :
MODIFIED ON : 1 JULY 2010
Description :
Error number can be found out using @@Error.
1033 = Language id for english
*/
SELECT
@strErrorMessage = description
FROM
master.sys.sysmessages
WHERE
error = @errorId and
msglangid = 1033;